2014-05-22 16:23:41 +02:00
|
|
|
|
//*****************************************************************
|
2013-04-09 12:41:27 +02:00
|
|
|
|
// Delphi-OpenCV Demo
|
|
|
|
|
// Copyright (C) 2013 Project Delphi-OpenCV
|
|
|
|
|
// ****************************************************************
|
|
|
|
|
// Contributor:
|
2014-05-22 16:23:41 +02:00
|
|
|
|
// Laentir Valetov
|
2013-04-09 12:41:27 +02:00
|
|
|
|
// email:laex@bk.ru
|
|
|
|
|
// ****************************************************************
|
|
|
|
|
// You may retrieve the latest version of this file at the GitHub,
|
|
|
|
|
// located at git://github.com/Laex/Delphi-OpenCV.git
|
|
|
|
|
// ****************************************************************
|
|
|
|
|
// The contents of this file are used with permission, subject to
|
|
|
|
|
// the Mozilla Public License Version 1.1 (the "License"); you may
|
|
|
|
|
// not use this file except in compliance with the License. You may
|
|
|
|
|
// obtain a copy of the License at
|
|
|
|
|
// http://www.mozilla.org/MPL/MPL-1_1Final.html
|
|
|
|
|
//
|
|
|
|
|
// Software distributed under the License is distributed on an
|
|
|
|
|
// "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
|
// implied. See the License for the specific language governing
|
|
|
|
|
// rights and limitations under the License.
|
2014-05-22 16:23:41 +02:00
|
|
|
|
//*******************************************************************
|
|
|
|
|
|
2013-01-01 13:29:34 +01:00
|
|
|
|
program HelloWorld;
|
|
|
|
|
|
2013-04-09 12:41:27 +02:00
|
|
|
|
{$APPTYPE CONSOLE}
|
2013-01-01 13:29:34 +01:00
|
|
|
|
{$R *.res}
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
System.SysUtils,
|
2014-05-22 16:23:41 +02:00
|
|
|
|
ocv.highgui_c,
|
|
|
|
|
ocv.core_c,
|
|
|
|
|
ocv.core.types_c;
|
2013-01-01 13:29:34 +01:00
|
|
|
|
|
2013-05-21 10:53:30 +02:00
|
|
|
|
var
|
2013-04-18 08:34:16 +02:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>c<EFBFBD><63><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-01-01 13:29:34 +01:00
|
|
|
|
height: Integer = 620;
|
|
|
|
|
width: Integer = 440;
|
|
|
|
|
pt: TCvPoint;
|
|
|
|
|
hw: pIplImage;
|
|
|
|
|
font: TCvFont;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
try
|
2013-04-18 08:34:16 +02:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>c<EFBFBD><63>
|
2013-01-01 13:29:34 +01:00
|
|
|
|
pt := CvPoint(height div 4, width div 2);
|
2013-04-18 08:34:16 +02:00
|
|
|
|
// c<><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 8-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 3-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-01-01 13:29:34 +01:00
|
|
|
|
hw := cvCreateImage(CvSize(height, width), 8, 3);
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-01-01 22:36:38 +01:00
|
|
|
|
CvSet(pCvArr(hw), cvScalar(0, 0, 0));
|
2013-01-01 13:29:34 +01:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cvInitFont(@font, CV_FONT_HERSHEY_COMPLEX, 1.0, 1.0, 0, 1, CV_AA);
|
2013-04-18 08:34:16 +02:00
|
|
|
|
// <20>c<EFBFBD><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>c<EFBFBD>
|
2013-01-01 13:29:34 +01:00
|
|
|
|
cvPutText(hw, 'OpenCV Step By Step', pt, @font, CV_RGB(150, 0, 150));
|
2013-04-18 08:34:16 +02:00
|
|
|
|
// c<><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-01-01 13:29:34 +01:00
|
|
|
|
cvNamedWindow('Hello World', 0);
|
2013-04-18 08:34:16 +02:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> c<><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
2013-01-01 13:29:34 +01:00
|
|
|
|
cvShowImage('Hello World', hw);
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cvWaitKey(0);
|
2013-04-18 08:34:16 +02:00
|
|
|
|
// <20>c<EFBFBD><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>c<EFBFBD><63>c<EFBFBD>
|
2013-01-01 13:29:34 +01:00
|
|
|
|
cvReleaseImage(hw);
|
|
|
|
|
cvDestroyWindow('Hello World');
|
|
|
|
|
except
|
|
|
|
|
on E: Exception do
|
|
|
|
|
Writeln(E.ClassName, ': ', E.Message);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|