mirror of
https://github.com/Laex/Delphi-OpenCV.git
synced 2024-11-16 16:25:53 +01:00
49 lines
1.1 KiB
ObjectPascal
49 lines
1.1 KiB
ObjectPascal
|
program InRange;
|
|||
|
|
|||
|
{$APPTYPE CONSOLE}
|
|||
|
{$R *.res}
|
|||
|
|
|||
|
uses
|
|||
|
System.SysUtils,
|
|||
|
core_c in '..\..\include\<5C>ore\core_c.pas',
|
|||
|
Core.types_c in '..\..\include\<5C>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
|
|||
|
src: pIplImage = nil;
|
|||
|
dst: pIplImage = nil;
|
|||
|
dst2: pIplImage = nil;
|
|||
|
|
|||
|
begin
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
src := cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
|
|||
|
WriteLn(Format('[i] image: %s', [filename]));
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
cvNamedWindow('original', CV_WINDOW_AUTOSIZE);
|
|||
|
cvShowImage('original', src);
|
|||
|
|
|||
|
dst := cvCreateImage(cvSize(src^.width, src^.height), IPL_DEPTH_8U, 1);
|
|||
|
|
|||
|
cvInRangeS(src, cvScalar(50), cvScalar(255), dst);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
cvNamedWindow('cvInRangeS', CV_WINDOW_AUTOSIZE);
|
|||
|
cvShowImage('cvInRangeS', dst);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
cvWaitKey(0);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
cvReleaseImage(src);
|
|||
|
cvReleaseImage(dst);
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
cvDestroyAllWindows();
|
|||
|
|
|||
|
end.
|