Delphi-OpenCV/samples/LibTest/cvSmooth/cv_Smooth.dpr
Laex ba000c1405 Add samples
LibTest
[+] cv_CalcOpticalFlowPyrLK
[+] cv_SnakeImage
MultiDemo
[+] CameraShift
[+] Squares

Signed-off-by: Laex <laex@bk.ru>
2013-04-05 15:36:47 +04:00

54 lines
1.2 KiB
ObjectPascal

// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
// JCL_DEBUG_EXPERT_INSERTJDBG OFF
// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
program cv_Smooth;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
{$I ..\..\uses_include.inc}
;
Const
// èìÿ êàðòèíêè
filename = 'Resource\cat2.jpg';
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.