mirror of
https://github.com/Laex/Delphi-OpenCV.git
synced 2024-11-16 16:25:53 +01:00
48dbfc5c3f
+ FloodFill + Weighted + Weighted2 + cvInRange + SplitMerge + cvAnd + CvtPixToPlane + cvCopyMakeBorder + LoadAndTransformImage Signed-off-by: Laex <laex@bk.ru>
42 lines
1.1 KiB
ObjectPascal
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.
|