Delphi-OpenCV/2.4.3/samples/Canny/Canny.dpr
Laex 5cfe443f3d Adding samples
* Canny
* Sobel
* Laplace
* cvSub
* HoughLines
* HoughCircles

to XE3

Signed-off-by: Laex <laex@bk.ru>
2013-01-07 18:02:10 +04:00

58 lines
1.3 KiB
ObjectPascal

program Canny;
{$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 = 'cat2.jpg';
Var
image: pIplImage = nil;
gray: pIplImage = nil;
dst: pIplImage = nil;
begin
// ďîëó÷ŕĺě ęŕđňčíęó
image := cvLoadImage(filename);
WriteLn(Format('[i] image: %s', [filename]));
// ńîçäŕ¸ě îäíîęŕíŕëüíűĺ ęŕđňčíęč
gray := cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
dst := cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
// îęíî äë˙ îňîáđŕćĺíč˙ ęŕđňčíęč
cvNamedWindow('original', CV_WINDOW_AUTOSIZE);
cvNamedWindow('gray', CV_WINDOW_AUTOSIZE);
cvNamedWindow('cvCanny', CV_WINDOW_AUTOSIZE);
// ďđĺîáđŕçóĺě â ăđŕäŕöčč ńĺđîăî
cvCvtColor(image, gray, CV_RGB2GRAY);
// ďîëó÷ŕĺě ăđŕíčöű
cvCanny(gray, dst, 10, 100, 3);
// ďîęŕçűâŕĺě ęŕđňčíęč
cvShowImage('original', image);
cvShowImage('gray', gray);
cvShowImage('cvCanny', dst);
// ćä¸ě íŕćŕňč˙ ęëŕâčřč
cvWaitKey(0);
// îńâîáîćäŕĺě đĺńóđńű
cvReleaseImage(image);
cvReleaseImage(gray);
cvReleaseImage(dst);
// óäŕë˙ĺě îęíŕ
cvDestroyAllWindows();
end.