Delphi-OpenCV/2.4.3/samples/Smooth/Smooth.dpr
Laex 6a4df01a2d To version 2.4.3
Signed-off-by: Laex <laex@bk.ru>
2013-01-01 16:29:34 +04:00

54 lines
1.3 KiB
ObjectPascal

program Smooth;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
Core.types_c in '..\..\include\ñore\Core.types_c.pas',
core_c in '..\..\include\ñore\core_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;
begin
try
// ïîëó÷àåì êàðòèíêó
image := cvLoadImage(filename, 1);
// êëîíèðóåì êàðòèíêó
dst := cvCloneImage(image);
Writeln('[i] image: ', filename);
if not Assigned(image) then
Halt;
// îêíî äëÿ îòîáðàæåíèÿ êàðòèíêè
cvNamedWindow('original', CV_WINDOW_AUTOSIZE);
cvNamedWindow('Smooth', CV_WINDOW_AUTOSIZE);
// ñãëàæèâàåì èñõîäíóþ êàðòèíêó
// cvSmooth(image, dst, CV_GAUSSIAN, 3, 3);
cvSmooth(image, dst, CV_BLUR_NO_SCALE, 3, 3);
// ïîêàçûâàåì êàðòèíêó
cvShowImage('original', image);
cvShowImage('Smooth', dst);
// æä¸ì íàæàòèÿ êëàâèøè
cvWaitKey(0);
// îñâîáîæäàåì ðåñóðñû
cvReleaseImage(&image);
cvReleaseImage(&dst);
// óäàëÿåì îêíî
cvDestroyWindow('original');
cvDestroyWindow('Smooth');
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.