mirror of
https://github.com/Laex/Delphi-OpenCV.git
synced 2024-11-15 07:45:53 +01:00
Fixed Delphi 7 support
Signed-off-by: Mikhail Grigorev <sleuthhound@gmail.com>
This commit is contained in:
parent
b5d6d50c85
commit
90111cb797
344
source/OpenCV.inc
Normal file
344
source/OpenCV.inc
Normal file
@ -0,0 +1,344 @@
|
||||
{$B-}
|
||||
|
||||
// Check IDE version
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER130} { Delphi 5, C++ Builder 5 }
|
||||
{$DEFINE VER5}
|
||||
{$DEFINE VER5P}
|
||||
{$IFDEF BCB}
|
||||
{$DEFINE CB5}
|
||||
{$ObjExportAll On}
|
||||
{$ELSE}
|
||||
{$DEFINE D5}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER140} { Delphi 6, C++ Builder 6 }
|
||||
{$DEFINE VER6}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$IFDEF BCB}
|
||||
{$DEFINE CB6}
|
||||
{$ObjExportAll On}
|
||||
{$ELSE}
|
||||
{$DEFINE D6}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER150} { Delphi 7 }
|
||||
{$IFNDEF BCB}
|
||||
{$DEFINE D7}
|
||||
{$DEFINE VER7}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER160} { Delphi 8 }
|
||||
{$DEFINE D8}
|
||||
{$DEFINE VER8}
|
||||
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER170} { Delphi 2005 }
|
||||
{$DEFINE D9}
|
||||
{$DEFINE VER9}
|
||||
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER180} { Delphi 2006 }
|
||||
{$IFNDEF VER185} { not Delphi 2007 Spacely}
|
||||
{$DEFINE D10}
|
||||
{$DEFINE VER10}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER185} { Delphi 2007 Spacely}
|
||||
{$DEFINE D11}
|
||||
{$ENDIF}
|
||||
{$IFDEF VER190} { Delphi 2007 Highlander}
|
||||
{$DEFINE D11}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF D11}
|
||||
{$DEFINE VER11}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$DEFINE VER11P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER200} { Delphi 2009 }
|
||||
{$DEFINE D12}
|
||||
{$DEFINE VER12}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$DEFINE VER11P}
|
||||
{$DEFINE VER12P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER210} { Delphi 2010 }
|
||||
{$DEFINE D14}
|
||||
{$DEFINE VER14}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$DEFINE VER11P}
|
||||
{$DEFINE VER12P}
|
||||
{$DEFINE VER14P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER220} { Delphi XE }
|
||||
{$DEFINE D15}
|
||||
{$DEFINE VER15}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$DEFINE VER11P}
|
||||
{$DEFINE VER12P}
|
||||
{$DEFINE VER14P}
|
||||
{$DEFINE VER15P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER230} { Delphi XE2 }
|
||||
{$DEFINE D16}
|
||||
{$DEFINE VER16}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$DEFINE VER11P}
|
||||
{$DEFINE VER12P}
|
||||
{$DEFINE VER14P}
|
||||
{$DEFINE VER15P}
|
||||
{$DEFINE VER16P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER240} { Delphi XE3 }
|
||||
{$DEFINE D17}
|
||||
{$DEFINE VER17}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$DEFINE VER11P}
|
||||
{$DEFINE VER12P}
|
||||
{$DEFINE VER14P}
|
||||
{$DEFINE VER15P}
|
||||
{$DEFINE VER16P}
|
||||
{$DEFINE VER17P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER250} { Delphi XE4 }
|
||||
{$DEFINE D18}
|
||||
{$DEFINE VER18}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$DEFINE VER11P}
|
||||
{$DEFINE VER12P}
|
||||
{$DEFINE VER14P}
|
||||
{$DEFINE VER15P}
|
||||
{$DEFINE VER16P}
|
||||
{$DEFINE VER17P}
|
||||
{$DEFINE VER18P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER260} { Delphi XE5 }
|
||||
{$DEFINE D19}
|
||||
{$DEFINE VER19}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$DEFINE VER11P}
|
||||
{$DEFINE VER12P}
|
||||
{$DEFINE VER14P}
|
||||
{$DEFINE VER15P}
|
||||
{$DEFINE VER16P}
|
||||
{$DEFINE VER17P}
|
||||
{$DEFINE VER18P}
|
||||
{$DEFINE VER19P}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER270} { Delphi XE6 }
|
||||
{$DEFINE D20}
|
||||
{$DEFINE VER20}
|
||||
{$DEFINE VER5P}
|
||||
{$DEFINE VER6P}
|
||||
{$DEFINE VER7P}
|
||||
{$DEFINE VER8P}
|
||||
{$DEFINE VER9P}
|
||||
{$DEFINE VER10P}
|
||||
{$DEFINE VER11P}
|
||||
{$DEFINE VER12P}
|
||||
{$DEFINE VER14P}
|
||||
{$DEFINE VER15P}
|
||||
{$DEFINE VER16P}
|
||||
{$DEFINE VER17P}
|
||||
{$DEFINE VER18P}
|
||||
{$DEFINE VER19P}
|
||||
{$DEFINE VER20P}
|
||||
{$ENDIF}
|
||||
|
||||
// End IDE version
|
||||
|
||||
{$IFDEF CPU64}
|
||||
{$DEFINE CPUX64} { assembler for x64 - Lazarus compatibility }
|
||||
{$ENDIF}
|
||||
{$IFDEF CPU86}
|
||||
{$DEFINE CPUX86} { assembler for x86 - Lazarus compatibility }
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF IOS}
|
||||
{$DEFINE MOBILE}
|
||||
{$ENDIF}
|
||||
{$IFDEF ANDROID}
|
||||
{$DEFINE MOBILE}
|
||||
{$ENDIF}
|
||||
{$IFDEF MOBILE}
|
||||
{$DEFINE PUREPASCAL}
|
||||
{$ENDIF}
|
||||
{$IFDEF CPUARM}
|
||||
{$DEFINE PUREPASCAL}
|
||||
{$ENDIF}
|
||||
{$IFDEF CLR}
|
||||
{$DEFINE PUREPASCAL}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$IFDEF IPHONESIM}
|
||||
{$DEFINE PUREPASCAL}
|
||||
{$ENDIF}
|
||||
{$IFNDEF PUREPASCAL}
|
||||
{$ASMMODE INTEL}
|
||||
{$ENDIF}
|
||||
{$MODE DELPHI}
|
||||
{$INTERFACES COM}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF WIN32}
|
||||
{$DEFINE MSWINDOWS}
|
||||
{$DEFINE WIN32_64}
|
||||
{$ENDIF}
|
||||
{$IFDEF WIN64}
|
||||
{$DEFINE MSWINDOWS}
|
||||
{$DEFINE WIN32_64}
|
||||
{$ENDIF}
|
||||
{$IFDEF CLR}
|
||||
{$DEFINE MSWINDOWS}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF DARWIN}
|
||||
{$DEFINE MACOS}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF NOINLINE}
|
||||
{$IFDEF FPC}
|
||||
{$DEFINE USE_INLINE}
|
||||
{$ENDIF}
|
||||
{$IFDEF VER9P}
|
||||
{$DEFINE USE_INLINE}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER7P}
|
||||
{$WARN UNSAFE_TYPE OFF}
|
||||
{$WARN UNSAFE_CODE OFF}
|
||||
{$WARN UNSAFE_CAST OFF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER6P}
|
||||
{$WARN SYMBOL_PLATFORM OFF}
|
||||
{$WARN SYMBOL_DEPRECATED OFF}
|
||||
{$WARN UNIT_PLATFORM OFF}
|
||||
{$WARN UNIT_DEPRECATED OFF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF VER6P}
|
||||
// Delphi5, CBuilder5 - UTF8 functions is not implemented
|
||||
{$DEFINE UTF8}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF CLR}
|
||||
{$IFDEF VER7P}
|
||||
{$DEFINE HAVE_COMPRESS} // ZLib build in Delphi
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF CLR}
|
||||
{$DEFINE IS_UNICODE}
|
||||
{$ENDIF}
|
||||
{$IFDEF VER12P}
|
||||
{$DEFINE IS_UNICODE}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF CLR}
|
||||
{$IFNDEF FPC}
|
||||
{$IFNDEF PUREPASCAL}
|
||||
{$IFNDEF CPUX64}
|
||||
{$DEFINE UseASM} // use Assembler optimated core
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF NEXTGEN}
|
||||
{$ZEROBASEDSTRINGS OFF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF VER16P}
|
||||
{$IFNDEF CLR}
|
||||
{$DEFINE EXTENDEDIS10BYTES}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$IFDEF VER16}
|
||||
{$IFNDEF CPUX64}
|
||||
{$DEFINE EXTENDEDIS10BYTES}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$DEFINE DYNAMIC_LINKING}
|
Binary file not shown.
@ -34,10 +34,10 @@
|
||||
-N"."
|
||||
-LE"c:\program files (x86)\borland\delphi7\Projects\Bpl"
|
||||
-LN"."
|
||||
-U"..\;..\..\;..\..\utils"
|
||||
-O"..\;..\..\;..\..\utils"
|
||||
-I"..\;..\..\;..\..\utils"
|
||||
-R"..\;..\..\;..\..\utils"
|
||||
-U"..\;..\..\;..\..\utils;..\..\..\resource\facedetectxml"
|
||||
-O"..\;..\..\;..\..\utils;..\..\..\resource\facedetectxml"
|
||||
-I"..\;..\..\;..\..\utils;..\..\..\resource\facedetectxml"
|
||||
-R"..\;..\..\;..\..\utils;..\..\..\resource\facedetectxml"
|
||||
-DRELEASE
|
||||
-Z
|
||||
-w-UNSAFE_TYPE
|
||||
|
@ -94,7 +94,7 @@ OutputDir=
|
||||
UnitOutputDir=.
|
||||
PackageDLLOutputDir=
|
||||
PackageDCPOutputDir=.
|
||||
SearchPath=..\;..\..\;..\..\utils
|
||||
SearchPath=..\;..\..\;..\..\utils;..\..\..\resource\facedetectxml
|
||||
Packages=
|
||||
Conditionals=RELEASE
|
||||
DebugSourceDirs=
|
||||
@ -140,10 +140,11 @@ Item0=RELEASE
|
||||
Count=1
|
||||
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
[HistoryLists\hlSearchPath]
|
||||
Count=3
|
||||
Item0=..\;..\..\;..\..\utils
|
||||
Item1=..\;..\..\
|
||||
Item2=..\;..\..\;..\..\include;..\..\include\calib3d;..\..\include\core;..\..\include\features2d;..\..\include\highgui;..\..\include\imgproc;..\..\include\legacy;..\..\include\ml;..\..\include\nonfree;..\..\include\objdetect;..\..\include\video
|
||||
Count=4
|
||||
Item0=..\;..\..\;..\..\utils;..\..\..\resource\facedetectxml
|
||||
Item1=..\;..\..\;..\..\utils
|
||||
Item2=..\;..\..\
|
||||
Item3=..\;..\..\;..\..\include;..\..\include\calib3d;..\..\include\core;..\..\include\features2d;..\..\include\highgui;..\..\include\imgproc;..\..\include\legacy;..\..\include\ml;..\..\include\nonfree;..\..\include\objdetect;..\..\include\video
|
||||
[HistoryLists\hlUnitOutputDirectory]
|
||||
Count=1
|
||||
Item0=.
|
||||
|
@ -53,6 +53,15 @@ uses
|
||||
ocv.core.types_c;
|
||||
|
||||
type
|
||||
{$IFDEF VER17P} //XE3..XE6
|
||||
TArrayDouble = TArray<Double>;
|
||||
TArrayInteger = TArray<Integer>;
|
||||
TArrayBoolean = TArray<Boolean>;
|
||||
{$ELSE} // D7...XE2
|
||||
TArrayDouble = Array of Double;
|
||||
TArrayInteger = Array of Integer;
|
||||
TArrayBoolean = Array of Boolean;
|
||||
{$ENDIF}
|
||||
|
||||
TocvCustomImageOperation = class(TComponent)
|
||||
protected
|
||||
@ -60,9 +69,9 @@ type
|
||||
private
|
||||
FCriticalSection: TCriticalSection;
|
||||
FOwner: TPersistent;
|
||||
FFloatParams: TArray<Double>;
|
||||
FIntParams: TArray<Integer>;
|
||||
FBoolParams: TArray<Boolean>;
|
||||
FFloatParams: TArrayDouble;
|
||||
FIntParams: TArrayInteger;
|
||||
FBoolParams: TArrayBoolean;
|
||||
FOnAfterPaint: TOnOcvAfterTransform;
|
||||
FOnBeforePaint: TOnOcvBeforeTransform;
|
||||
protected
|
||||
|
@ -88,7 +88,11 @@ Type
|
||||
of object;
|
||||
|
||||
TocvRect = Type TRect;
|
||||
{$IFDEF VER17P}
|
||||
TocvRects = TArray<TocvRect>;
|
||||
{$ELSE}
|
||||
TocvRects = Array of TocvRect;
|
||||
{$ENDIF}
|
||||
|
||||
TOnOcvHaarCascade = procedure(Sender: TObject; const IplImage: IocvImage; const HaarRects: TocvRects) of object;
|
||||
TOnOcvRect = procedure(Sender: TObject; const IplImage: IocvImage; const Rect: TocvRect) of object;
|
||||
@ -113,7 +117,7 @@ Type
|
||||
TocvReceiverList = class(TThreadList) // <IocvDataReceiver>;
|
||||
public
|
||||
procedure Add(Item: IocvDataReceiver);
|
||||
procedure Remove(Item: IocvDataReceiver); inline;
|
||||
procedure Remove(Item: IocvDataReceiver); {$IFDEF VER9P}inline;{$ENDIF}
|
||||
end;
|
||||
|
||||
TocvDataSource = class(TComponent, IocvDataSource)
|
||||
|
@ -1369,9 +1369,11 @@ type
|
||||
(seq)->first->data + (index) * sizeof(elem_type) : \
|
||||
cvGetSeqElem( (CvSeq*)(seq), (index) )))
|
||||
}
|
||||
{$IFDEF VER15P}
|
||||
function CV_SEQ_ELEM(Seq: pCvSeq; const size_of_elem: Integer; index: Integer): Pointer; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
{#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )}
|
||||
function CV_GET_SEQ_ELEM(const size_of_elem: Integer; Seq: pCvSeq; index: Integer): Pointer; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
{$ENDIF VER15P}
|
||||
|
||||
// (* Add element to sequence: *)
|
||||
// // >> Following declaration is a macro definition!
|
||||
@ -2512,12 +2514,6 @@ begin
|
||||
Result := CV_MAKETYPE(CV_32S, 2);
|
||||
end;
|
||||
|
||||
function CV_GET_SEQ_ELEM;
|
||||
begin
|
||||
{#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )}
|
||||
Result := CV_SEQ_ELEM(Seq, size_of_elem, index);
|
||||
end;
|
||||
|
||||
function CV_CAST_8U(t: Integer): uchar;
|
||||
begin
|
||||
if (not(t and (not 255)) <> 0) then
|
||||
@ -2528,6 +2524,13 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
{$IFDEF VER15P}
|
||||
function CV_GET_SEQ_ELEM;
|
||||
begin
|
||||
{#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM( (seq), elem_type, (index) )}
|
||||
Result := CV_SEQ_ELEM(Seq, size_of_elem, index);
|
||||
end;
|
||||
|
||||
function CV_SEQ_ELEM(Seq: pCvSeq; const size_of_elem: Integer; index: Integer): Pointer; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
begin
|
||||
// assert(sizeof((seq)->first[0]) == sizeof(CvSeqBlock) && (seq)->elem_size == sizeof(elem_type))
|
||||
@ -2540,6 +2543,7 @@ begin
|
||||
// cvGetSeqElem( (CvSeq*)(seq), (index) )))
|
||||
Result := cvGetSeqElem(Seq, index);
|
||||
end;
|
||||
{$ENDIF VER15P}
|
||||
|
||||
function CV_8UC1: Integer; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
begin
|
||||
@ -2585,7 +2589,7 @@ end;
|
||||
function CV_IMAGE_ELEM(image: pIplImage; size_elemtype, row, col: Integer): Pointer; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
begin
|
||||
// (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)])
|
||||
Result := pByte(image^.imageData) + image^.widthStep * row + col * size_elemtype;
|
||||
Result := {$IFDEF D7}Pointer({$ENDIF D7}{$IFDEF VER9P}pByte{$ELSE}Integer{$ENDIF}(image^.imageData) + image^.widthStep * row + col * size_elemtype{$IFDEF D7}){$ENDIF D7};
|
||||
end;
|
||||
|
||||
function cvRealScalar(val0: Double): TCvScalar; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
|
@ -40,20 +40,28 @@
|
||||
// Q&A forum: http://answers.ocv.org
|
||||
// Dev zone: http://code.ocv.org
|
||||
// ************************************************************************************************** *)
|
||||
{$I OpenCV.inc}
|
||||
|
||||
{$IFDEF VER12P}
|
||||
{$POINTERMATH ON}
|
||||
{$ENDIF}
|
||||
unit ocv.cvutils;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF VER15P}
|
||||
WinApi.Windows,
|
||||
Vcl.Graphics,
|
||||
{$ELSE}
|
||||
Windows,
|
||||
Graphics,
|
||||
{$ENDIF VER15P}
|
||||
ocv.core.types_c;
|
||||
|
||||
Function hsv2rgb(hue: single): TCvScalar;
|
||||
procedure IplImage2Bitmap(iplImg: PIplImage; var bitmap: Vcl.Graphics.TBitmap);
|
||||
function cvImage2Bitmap(img: PIplImage): Vcl.Graphics.TBitmap;
|
||||
procedure IplImage2Bitmap(iplImg: PIplImage; var bitmap: {$IFDEF VER15P}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF VER15P});
|
||||
function cvImage2Bitmap(img: PIplImage): {$IFDEF VER15P}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF VER15P};
|
||||
|
||||
function ipDraw(dc: HDC; img: PIplImage; const rect: TRect; const Stretch: Boolean = true): Boolean; overload;
|
||||
procedure ipDraw(const x, y: Integer; const _Grab: PIplImage; const Wnd: THandle); overload;
|
||||
@ -65,16 +73,20 @@ function ifthen(const Cond: Boolean; const ValueTrue, ValueFalse: pCvArr): pCvAr
|
||||
function ifthen(const Cond: Boolean; const ValueTrue, ValueFalse: string): string; overload;
|
||||
function ifthen(const Cond: Boolean; const ValueTrue, ValueFalse: TCvScalar): TCvScalar; overload;
|
||||
|
||||
function BitmapToIplImage(const bitmap: Vcl.Graphics.TBitmap): PIplImage;
|
||||
function BitmapToIplImage(const bitmap: {$IFDEF VER15P}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF VER15P}): PIplImage;
|
||||
function CropIplImage(const src: PIplImage; const roi: TCvRect): PIplImage;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
{$IFDEF VER15P}
|
||||
System.SysUtils,
|
||||
{$ELSE}
|
||||
SysUtils,
|
||||
{$ENDIF VER15P}
|
||||
ocv.core_c;
|
||||
|
||||
function BitmapToIplImage(const bitmap: Vcl.Graphics.TBitmap): PIplImage;
|
||||
function BitmapToIplImage(const bitmap: {$IFDEF VER15P}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF VER15P}): PIplImage;
|
||||
Var
|
||||
bitmapData: PByte;
|
||||
begin
|
||||
@ -129,7 +141,7 @@ end;
|
||||
// ---------------------------------------------------------------------------
|
||||
function CreateRGBBitmap(_Grab: PIplImage): HBITMAP;
|
||||
|
||||
function WIDTHBYTES(bits: DWORD): DWORD; inline;
|
||||
function WIDTHBYTES(bits: DWORD): DWORD; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
begin
|
||||
Result := ((((bits) + 31) div 32) * 4);
|
||||
end;
|
||||
@ -236,7 +248,7 @@ End;
|
||||
Arguments: iplImg: PIplImage; bitmap: TBitmap
|
||||
Description: convert a IplImage to a Windows bitmap
|
||||
-----------------------------------------------------------------------------}
|
||||
procedure IplImage2Bitmap(iplImg: PIplImage; var bitmap: Vcl.Graphics.TBitmap);
|
||||
procedure IplImage2Bitmap(iplImg: PIplImage; var bitmap: {$IFDEF VER15P}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF VER15P});
|
||||
VAR
|
||||
i, j: Integer;
|
||||
offset: longint;
|
||||
@ -283,10 +295,10 @@ BEGIN
|
||||
End
|
||||
END; {IplImage2Bitmap}
|
||||
|
||||
function cvImage2Bitmap(img: PIplImage): Vcl.Graphics.TBitmap;
|
||||
function cvImage2Bitmap(img: PIplImage): {$IFDEF VER15P}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF VER15P};
|
||||
var
|
||||
// info: string;
|
||||
bmp: Vcl.Graphics.TBitmap;
|
||||
bmp: {$IFDEF VER15P}Vcl.Graphics.TBitmap{$ELSE}Graphics.TBitmap{$ENDIF VER15P};
|
||||
deep: Integer;
|
||||
i, j, K, wStep, Channels: Integer;
|
||||
data: PByteArray;
|
||||
@ -295,7 +307,7 @@ begin
|
||||
Result := NIL;
|
||||
if (img <> NIL) then
|
||||
begin
|
||||
bmp := Vcl.Graphics.TBitmap.Create;
|
||||
bmp := {$IFDEF VER15P}Vcl.Graphics.TBitmap.Create{$ELSE}Graphics.TBitmap.Create{$ENDIF VER15P};
|
||||
bmp.Width := img^.Width;
|
||||
bmp.Height := img^.Height;
|
||||
deep := img^.nChannels * img^.depth;
|
||||
|
@ -768,7 +768,7 @@ const
|
||||
function cvCreateVideoWriter(const filename: pCVChar; fourcc: Integer; fps: Double; frame_size: TCvSize;
|
||||
is_color: Integer = 1): pCvVideoWriter; cdecl;
|
||||
|
||||
function CV_FOURCC(const c1, c2, c3, c4: CVChar): Integer; inline;
|
||||
function CV_FOURCC(const c1, c2, c3, c4: CVChar): Integer; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
|
||||
|
||||
// CVAPI(CvVideoWriter*) cvCreateImageSequenceWriter( const char* filename,
|
||||
@ -873,7 +873,7 @@ procedure cvSetMouseCallback; external highgui_lib;
|
||||
procedure cvConvertImage; external highgui_lib;
|
||||
procedure cvMoveWindow; external highgui_lib;
|
||||
|
||||
function CV_FOURCC(const c1, c2, c3, c4: CVChar): Integer; inline;
|
||||
function CV_FOURCC(const c1, c2, c3, c4: CVChar): Integer; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
begin
|
||||
Result := Integer(c1) + (Integer(c2) shl 8) + (Integer(c3) shl 16) + (Integer(c4) shl 24);
|
||||
end;
|
||||
|
@ -409,7 +409,7 @@ type
|
||||
*************************************************************************************** *)
|
||||
|
||||
type
|
||||
TCvSubdiv2DEdge = size_t;
|
||||
TCvSubdiv2DEdge = NativeUInt;
|
||||
{ EXTERNALSYM CvSubdiv2DEdge }
|
||||
|
||||
pCvSubdiv2DPoint = ^TCvSubdiv2DPoint;
|
||||
|
@ -612,7 +612,7 @@ function cvArcLength(const curve: Pointer; slice: TCvSlice { = CV_WHOLE_SEQ }; i
|
||||
return cvArcLength( contour, CV_WHOLE_SEQ, 1 );
|
||||
}
|
||||
*)
|
||||
function cvContourPerimeter(const contour: Pointer): double; inline;
|
||||
function cvContourPerimeter(const contour: Pointer): double; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
|
||||
// * Calculates contour boundning rectangle (update=1) or
|
||||
// just retrieves pre-calculated rectangle (update=0) */
|
||||
@ -769,7 +769,7 @@ procedure cvCalcArrHist(var arr: pIplImage; hist: pCvHistogram; accumulate: Inte
|
||||
// {
|
||||
// cvCalcArrHist( (CvArr**)image, hist, accumulate, mask );
|
||||
// }
|
||||
procedure cvCalcHist(var image: pIplImage; hist: pCvHistogram; accumulate: Integer = 0; const mask: pIplImage = nil); inline;
|
||||
procedure cvCalcHist(var image: pIplImage; hist: pCvHistogram; accumulate: Integer = 0; const mask: pIplImage = nil); {$IFDEF VER9P}inline;{$ENDIF}
|
||||
|
||||
|
||||
// var mask CV_DEFAULT(0) )begin cvCalcArrHist( (CvArr*)image: vArr;
|
||||
@ -1052,7 +1052,7 @@ procedure cvInitUndistortMap; external imgproc_lib;
|
||||
procedure cvRemap; external imgproc_lib;
|
||||
function cvArcLength; external imgproc_lib;
|
||||
|
||||
function cvContourPerimeter(const contour: Pointer): double; inline;
|
||||
function cvContourPerimeter(const contour: Pointer): double; {$IFDEF VER9P}inline;{$ENDIF}
|
||||
begin
|
||||
result := cvArcLength(contour, CV_WHOLE_SEQ, 1);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user