Delphi-OpenCV/2.4.3/samples/LoadAndTransformImage/LoadAndTransformImage.dpr
Laex 48dbfc5c3f Add samples:
+ FloodFill
+ Weighted
+ Weighted2
+ cvInRange
+ SplitMerge
+ cvAnd
+ CvtPixToPlane
+ cvCopyMakeBorder
+ LoadAndTransformImage

Signed-off-by: Laex <laex@bk.ru>
2013-01-02 01:36:38 +04:00

42 lines
1.1 KiB
ObjectPascal

program LoadAndTransformImage;
{$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';
filename_gray = 'opencv_logo_with_text_gray.png';
Var
image: pIplImage = nil;
gray_image: pIplImage = nil;
begin
try
image := cvLoadImage(filename, 1);
gray_image := cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
cvCvtColor(image, gray_image, CV_RGB2GRAY);
cvSaveImage(filename_gray, gray_image);
cvNamedWindow(filename, CV_WINDOW_AUTOSIZE);
cvNamedWindow('Gray image', CV_WINDOW_AUTOSIZE);
cvShowImage(filename, image);
cvShowImage('Gray image', gray_image);
cvWaitKey(0);
cvReleaseImage(image);
cvReleaseImage(gray_image);
cvDestroyAllWindows;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.