mirror of
https://github.com/Laex/Delphi-OpenCV.git
synced 2024-11-16 08:15:52 +01:00
70 lines
2.0 KiB
ObjectPascal
70 lines
2.0 KiB
ObjectPascal
|
program LoadImage;
|
|||
|
|
|||
|
{$APPTYPE CONSOLE}
|
|||
|
{$R *.res}
|
|||
|
|
|||
|
uses
|
|||
|
System.SysUtils,
|
|||
|
Core.types_c in '..\..\include\<5C>ore\Core.types_c.pas',
|
|||
|
core_c in '..\..\include\<5C>ore\core_c.pas',
|
|||
|
highgui_c in '..\..\include\highgui\highgui_c.pas';
|
|||
|
|
|||
|
Const
|
|||
|
filename = 'opencv_logo_with_text.png';
|
|||
|
|
|||
|
Var
|
|||
|
image: pIplImage = nil;
|
|||
|
src: pIplImage = nil;
|
|||
|
|
|||
|
begin
|
|||
|
try
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
image := cvLoadImage(filename, 1);
|
|||
|
if Assigned(image) then
|
|||
|
begin
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
src := cvCloneImage(image);
|
|||
|
if Assigned(src) then
|
|||
|
begin
|
|||
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
cvNamedWindow('original', CV_WINDOW_AUTOSIZE);
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
cvShowImage('original', image);
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
WriteLn('src');
|
|||
|
with src^ do
|
|||
|
begin
|
|||
|
WriteLn(Format('[i] channels: %d', [nChannels]));
|
|||
|
WriteLn(Format('[i] pixel depth: %d bits', [depth]));
|
|||
|
WriteLn(Format('[i] width: %d pixels', [width]));
|
|||
|
WriteLn(Format('[i] height: %d pixels', [height]));
|
|||
|
WriteLn(Format('[i] image size: %d bytes', [imageSize]));
|
|||
|
WriteLn(Format('[i] width step: %d bytes', [widthStep]));
|
|||
|
end;
|
|||
|
WriteLn;
|
|||
|
WriteLn('original');
|
|||
|
with src^ do
|
|||
|
begin
|
|||
|
WriteLn(Format('[i] channels: %d', [nChannels]));
|
|||
|
WriteLn(Format('[i] pixel depth: %d bits', [depth]));
|
|||
|
WriteLn(Format('[i] width: %d pixels', [width]));
|
|||
|
WriteLn(Format('[i] height: %d pixels', [height]));
|
|||
|
WriteLn(Format('[i] image size: %d bytes', [imageSize]));
|
|||
|
WriteLn(Format('[i] width step: %d bytes', [widthStep]));
|
|||
|
end;
|
|||
|
// <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(image);
|
|||
|
cvReleaseImage(src);
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
cvDestroyWindow('original');
|
|||
|
end;
|
|||
|
end;
|
|||
|
except
|
|||
|
on E: Exception do
|
|||
|
WriteLn(E.ClassName, ': ', E.Message);
|
|||
|
end;
|
|||
|
|
|||
|
end.
|