mirror of
https://github.com/Laex/Delphi-OpenCV.git
synced 2024-11-16 16:25:53 +01:00
48dbfc5c3f
+ FloodFill + Weighted + Weighted2 + cvInRange + SplitMerge + cvAnd + CvtPixToPlane + cvCopyMakeBorder + LoadAndTransformImage Signed-off-by: Laex <laex@bk.ru>
56 lines
1.5 KiB
ObjectPascal
56 lines
1.5 KiB
ObjectPascal
program 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';
|
|
|
|
const
|
|
filename = '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.
|