Delphi-OpenCV/samples/LibTest/cvCopyMakeBorder/cv_CopyMakeBorder.dpr
Laex 06de9955d7 Many changes
[*] Repository rebuilt
[*] CameraCalibrate - now working
[+] Improved cvSave
[+] Implemented macro CV_MAT_ELEM
[+] CvOpenFileStorage
and more ...

Signed-off-by: Laex <laex@bk.ru>
2013-04-02 02:17:25 +04:00

61 lines
1.7 KiB
ObjectPascal

// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
// JCL_DEBUG_EXPERT_INSERTJDBG OFF
// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
program cv_CopyMakeBorder;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
core_c in '..\..\..\include\ñore\core_c.pas',
Core.types_c in '..\..\..\include\ñore\Core.types_c.pas',
highgui_c in '..\..\..\include\highgui\highgui_c.pas',
imgproc.types_c in '..\..\..\include\imgproc\imgproc.types_c.pas',
imgproc_c in '..\..\..\include\imgproc\imgproc_c.pas',
uLibName in '..\..\..\include\uLibName.pas',
types_c in '..\..\..\include\ñore\types_c.pas';
const
filename = 'Resource\opencv_logo_with_text.png';
Var
image :pIplImage= nil;
dst :pIplImage= nil;
dst2 :pIplImage= nil;
begin
// ïîëó÷àåì êàðòèíêó
image := cvLoadImage(filename,1);
WriteLn(Format('[i] image: %s', [filename]));
// ñîçäà¸ì êàðòèíêè
dst := cvCreateImage( cvSize(image^.width+20, image^.height+20), image^.depth, image^.nChannels);
dst2 := cvCreateImage( cvSize(image^.width+20, image^.height+20), image^.depth, image^.nChannels);
// îêíî äëÿ îòîáðàæåíèÿ êàðòèíêè
cvNamedWindow('original',CV_WINDOW_AUTOSIZE);
cvNamedWindow('IPL_BORDER_CONSTANT',CV_WINDOW_AUTOSIZE);
cvNamedWindow('IPL_BORDER_REPLICATE',CV_WINDOW_AUTOSIZE);
// îáðàìëÿåì ãðàíèöåé
cvCopyMakeBorder(image, dst, cvPoint(10,10), IPL_BORDER_CONSTANT, cvScalar(250));
cvCopyMakeBorder(image, dst2, cvPoint(10,10), IPL_BORDER_REPLICATE, cvScalar(250));
// ïîêàçûâàåì êàðòèíêó
cvShowImage('original',image);
cvShowImage('IPL_BORDER_CONSTANT',dst);
cvShowImage('IPL_BORDER_REPLICATE',dst2);
// æä¸ì íàæàòèÿ êëàâèøè
cvWaitKey(0);
// îñâîáîæäàåì ðåñóðñû
cvReleaseImage(&image);
cvReleaseImage(&dst);
cvReleaseImage(&dst2);
// óäàëÿåì îêíà
cvDestroyAllWindows();
end.