diff --git a/.gitignore b/.gitignore index e0670ac..3466ba0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ #Directories buildtest +backup/ __history/ __recovery/ Debug/ diff --git a/README.md b/README.md index a9905c9..047640c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Delphi-OpenCV * OpenCV version - 2.4.13
-* Development environment - Delphi 2010-10.3
+* Development environment - Delphi 2010-10.3, FPC
Contributors: diff --git a/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.lpi b/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.lpi new file mode 100644 index 0000000..59c7d33 --- /dev/null +++ b/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.lpi @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="LCL"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="cvSetImageROI_cvAddWeighted.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\Win32\cvSetImageROI_cvAddWeighted.exe"/> + </Target> + <SearchPaths> + <IncludeFiles Value="..\..\..\source;$(ProjOutDir)"/> + <OtherUnitFiles Value="..\..\..\source;..\..\..\source\utils"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.lpr b/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.lpr new file mode 100644 index 0000000..6d07513 --- /dev/null +++ b/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.lpr @@ -0,0 +1,95 @@ +//***************************************************************** + // Delphi-OpenCV Demo + // Copyright (C) 2013 Project Delphi-OpenCV + // **************************************************************** + // Contributor: + // Laentir Valetov + // 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. + //******************************************************************* + +program cvSetImageROI_cvAddWeighted; + +{$MODE Delphi} + +{$APPTYPE CONSOLE} +{$R *.res} + +uses + SysUtils, + ocv.highgui_c, + ocv.core_c, + ocv.core.types_c, + ocv.imgproc_c, + uResourcePaths; + +Const + filename_src1 = cResourceMedia + 'cat2-mirror.jpg'; + filename_src2 = cResourceMedia + 'cat2.jpg'; + +Var + image: pIplImage = nil; + templ: pIplImage = nil; + dst: pIplImage = nil; + x, y, width, height: Integer; + alpha, beta: Double; + +begin +try + image := cvLoadImage(filename_src1); + WriteLn(Format('[i] image_src1: %s', [filename_src1])); + templ := cvLoadImage(filename_src2); + WriteLn(Format('[i] image_src2: %s', [filename_src2])); + + cvNamedWindow('origianl', CV_WINDOW_AUTOSIZE); + cvNamedWindow('template', CV_WINDOW_AUTOSIZE); + cvNamedWindow('res', CV_WINDOW_AUTOSIZE); + dst := cvCloneImage(templ); + // размер шаблона + width := templ^.width; + height := templ^.height; + + // оригинал и шаблон + cvShowImage('origianl', image); + cvShowImage('template', templ); + + x := 0; + y := 0; + // задаём веcовые коэффициенты + alpha := 0.5; + beta := 0.5; + // уcтанавливаем облccть интереcа + cvSetImageROI(image, cvRect(x, y, width, height)); + // взвешенная cумма + cvAddWeighted(image, alpha, templ, beta, 0.0, dst); + // оcвобождаем облccть интереcа + cvResetImageROI(image); + // показываем результат + cvShowImage('res', dst); + + // ждём нажатия клавиши + cvWaitKey(0); + + // оcвобождаем реcурcы + cvReleaseImage(image); + cvReleaseImage(templ); + cvReleaseImage(dst); + cvDestroyAllWindows(); + except + on E: Exception do + Writeln(E.ClassName, ': ', E.Message); + end; +end. diff --git a/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.lps b/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.lps new file mode 100644 index 0000000..69179f1 --- /dev/null +++ b/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.lps @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="1"> + <Unit0> + <Filename Value="cvSetImageROI_cvAddWeighted.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="19"/> + <CursorPos X="3" Y="34"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit0> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="cvSetImageROI_cvAddWeighted.lpr"/> + <Caret Line="14" Column="99"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> + <SkipCheckLCLInterfaces Value="True"/> +</CONFIG> diff --git a/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.res b/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.res new file mode 100644 index 0000000..d95ca05 Binary files /dev/null and b/samples/FPC/cvAddWeighted/cvSetImageROI_cvAddWeighted.res differ diff --git a/samples/FPC/cvAddWeighted/cv_AddWeighted.lpi b/samples/FPC/cvAddWeighted/cv_AddWeighted.lpi new file mode 100644 index 0000000..e6fd025 --- /dev/null +++ b/samples/FPC/cvAddWeighted/cv_AddWeighted.lpi @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="cv_AddWeighted"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="LCL"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="cv_AddWeighted.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="..\..\..\source\backup\ocv.core.types_c.pas"/> + <IsPartOfProject Value="True"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\Win32\cv_AddWeighted.exe"/> + </Target> + <SearchPaths> + <IncludeFiles Value="..\..\..\source;$(ProjOutDir)"/> + <OtherUnitFiles Value="..\..\..\source;..\..\..\source\utils"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/samples/FPC/cvAddWeighted/cv_AddWeighted.lpr b/samples/FPC/cvAddWeighted/cv_AddWeighted.lpr new file mode 100644 index 0000000..6da45d9 --- /dev/null +++ b/samples/FPC/cvAddWeighted/cv_AddWeighted.lpr @@ -0,0 +1,68 @@ +(* + ***************************************************************** + Delphi-OpenCV Demo + Copyright (C) 2013 Project Delphi-OpenCV + **************************************************************** + Contributor: + Laentir Valetov + 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. + ******************************************************************* +*) +program cv_AddWeighted; + +{$MODE Delphi} + +{$APPTYPE CONSOLE} +{$R *.res} + +uses + SysUtils, + ocv.highgui_c, + ocv.core_c, + ocv.core.types_c, + ocv.imgproc_c, + uResourcePaths; + +Const + filename_src1 = cResourceMedia + 'cat2-mirror.jpg'; + filename_src2 = cResourceMedia + 'cat2.jpg'; + +Var + alpha: Double = 0.5; + beta, input: Double; + src1, src2, dst: pIplImage; + +begin + try + src1 := cvLoadImage(filename_src1); + src2 := cvLoadImage(filename_src2); + cvNamedWindow('Linear Blend', CV_WINDOW_AUTOSIZE); + beta := (1.0 - alpha); + dst := cvCloneImage(src1); + cvAddWeighted(src1, alpha, src2, beta, 0, dst); + cvShowImage('Linear Blend', dst); + cvwaitKey(0); + cvReleaseImage(src1); + cvReleaseImage(src2); + cvReleaseImage(dst); + cvDestroyAllWindows; + except + on E: Exception do + Writeln(E.ClassName, ': ', E.Message); + end; + +end. diff --git a/samples/FPC/cvAddWeighted/cv_AddWeighted.lps b/samples/FPC/cvAddWeighted/cv_AddWeighted.lps new file mode 100644 index 0000000..526862f --- /dev/null +++ b/samples/FPC/cvAddWeighted/cv_AddWeighted.lps @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="cv_AddWeighted.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="18"/> + <CursorPos X="76" Y="38"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="..\..\..\source\backup\ocv.core.types_c.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="-1"/> + <TopLine Value="-1"/> + <CursorPos X="-1" Y="-1"/> + <UsageCount Value="20"/> + </Unit1> + <Unit2> + <Filename Value="..\..\..\source\backup\ocv.highgui_c.pas"/> + <EditorIndex Value="1"/> + <TopLine Value="38"/> + <CursorPos X="85" Y="53"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit2> + </Units> + <JumpHistory Count="2" HistoryIndex="1"> + <Position1> + <Filename Value="cv_AddWeighted.lpr"/> + <Caret Line="33" Column="12" TopLine="16"/> + </Position1> + <Position2> + <Filename Value="..\..\..\source\backup\ocv.highgui_c.pas"/> + <Caret Line="53" Column="85" TopLine="38"/> + </Position2> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> + <SkipCheckLCLInterfaces Value="True"/> +</CONFIG> diff --git a/samples/FPC/cvAddWeighted/cv_AddWeighted.res b/samples/FPC/cvAddWeighted/cv_AddWeighted.res new file mode 100644 index 0000000..d95ca05 Binary files /dev/null and b/samples/FPC/cvAddWeighted/cv_AddWeighted.res differ diff --git a/source/OpenCV.inc b/source/OpenCV.inc index e1aeef6..9d46547 100644 --- a/source/OpenCV.inc +++ b/source/OpenCV.inc @@ -8,13 +8,15 @@ Error!! {$IFEND} +{$IFNDEF FPC} {$IFDEF DEBUG} {$A8,B-,C+,D+,E-,F-,G+,H+,I+,J+,K-,L+,M-,N+,O-,P+,Q+,R+,S-,T-,U-,V+,W+,X+,Y+,Z1} {$ELSE} {$A8,B-,C-,D-,E-,F-,G+,H+,I+,J+,K-,L-,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y-,Z1} {$ENDIF} - {$POINTERMATH ON} +{$ENDIF} + {.$DEFINE SAFELOADLIB} {$IFDEF SAFELOADLIB} {$IFDEF DEBUG} @@ -22,12 +24,14 @@ {$ENDIF} {$ENDIF} -{$WARN SYMBOL_DEPRECATED OFF} -{$WARN SYMBOL_PLATFORM OFF} -{$WARN UNIT_PLATFORM OFF} -{$WARN UNSAFE_TYPE OFF} -{$WARN UNSAFE_CODE OFF} -{$WARN UNSAFE_CAST OFF} +{$IFNDEF FPC} + {$WARN SYMBOL_DEPRECATED OFF} + {$WARN SYMBOL_PLATFORM OFF} + {$WARN UNIT_PLATFORM OFF} + {$WARN UNSAFE_TYPE OFF} + {$WARN UNSAFE_CODE OFF} + {$WARN UNSAFE_CAST OFF} +{$ENDIF} (* - Development environment directives @@ -531,12 +535,11 @@ EXTENDEDSYNTAX_ON Compiling in the X+ state (Delphi extended syntax enabled) *) -{$DEFINE BORLAND} - { Set FreePascal to Delphi mode } {$IFDEF FPC} - {$MODE DELPHI} - {$UNDEF BORLAND} + {$mode objfpc} + {$H+} + {$modeswitch ADVANCEDRECORDS} {$DEFINE CPUASM} // FPC defines CPU32, CPU64 and Unix automatically {$IFDEF IPHONESIM} @@ -545,8 +548,11 @@ {$IFNDEF PUREPASCAL} {$ASMMODE INTEL} {$ENDIF} - {$MODE DELPHI} {$INTERFACES COM} + {$DEFINE DELPHIXE_UP} + {$DEFINE USE_INLINE} +{$ELSE} + {$DEFINE BORLAND} {$ENDIF} {$IFDEF BORLAND} diff --git a/source/classes/ocv.cls.contrib.pas b/source/classes/ocv.cls.contrib.pas index 0f71439..c600050 100644 --- a/source/classes/ocv.cls.contrib.pas +++ b/source/classes/ocv.cls.contrib.pas @@ -37,7 +37,7 @@ Uses Type TInputArrayOfIplImage = TArrayOfpIplImage; // InputArrayOfArrays TInputArrayOfMat = TArrayOfIMat; // InputArrayOfArrays - TInputArrayOfInteger = TArray<Integer>; // InputArray + TInputArrayOfInteger = {$IFDEF FPC}specialize {$ENDIF}TArray<Integer>; // InputArray IFaceRecognizer = interface(IOCVCommon) ['{199DE478-2C78-4347-B553-C062290C78D2}'] @@ -200,7 +200,7 @@ end; procedure TFaceRecognizer.train(src: TInputArrayOfMat; labels: TInputArrayOfInteger); Var - src_mat: TArray<TOpenCVClass>; + src_mat: {$IFDEF FPC}specialize {$ENDIF}TArray<TOpenCVClass>; i: Integer; begin SetLength(src_mat, Length(src)); @@ -237,7 +237,7 @@ initialization Init_opencv_contrib; {$ELSE} -function InitModule_contrib; external opencv_contrib_lib name '?initModule_contrib@cv@@YA_NXZ'; +function InitModule_contrib(): cbool; cdecl; external opencv_contrib_lib name '?initModule_contrib@cv@@YA_NXZ'; {$ENDIF} end. diff --git a/source/classes/ocv.cls.core.pas b/source/classes/ocv.cls.core.pas index de69fc1..5142c35 100644 --- a/source/classes/ocv.cls.core.pas +++ b/source/classes/ocv.cls.core.pas @@ -54,9 +54,9 @@ Type end; IRect = IRect2i; - TVectorRect = TArray<IRect>; - TVectorInt = TArray<integer>; - TVectorDouble = TArray<double>; + TVectorRect = {$IFDEF FPC}specialize {$ENDIF}TArray<IRect>; + TVectorInt = {$IFDEF FPC}specialize {$ENDIF}TArray<integer>; + TVectorDouble = {$IFDEF FPC}specialize {$ENDIF}TArray<double>; (* ! When the break-on-error mode is set, the default error handler @@ -365,8 +365,8 @@ Type function data(): pointer; // 11 end; - TArrayOfTMat = TArray<TMat>; - TArrayOfIMat = TArray<IMat>; + TArrayOfTMat ={$IFDEF FPC}specialize {$ENDIF}TArray<TMat>; + TArrayOfIMat ={$IFDEF FPC}specialize {$ENDIF}TArray<IMat>; TIplImageRecordHelper = record helper for TIplImage function InitFromMat(const Mat: IMat): TIplImage; @@ -515,20 +515,20 @@ initialization Init_opencv_cls_core; {$ELSE} -function setBreakOnError; external core_lib name '?setBreakOnError@cv@@YA_N_N@Z'; -function redirectError; external core_lib name '?redirectError@cv@@YAP6AHHPBD00HPAX@ZP6AHH000H1@Z1PAPAX@Z'; -procedure setNumThreads; external core_lib name '?setNumThreads@cv@@YAXH@Z'; -function getNumThreads; external core_lib name '?getNumThreads@cv@@YAHXZ'; -function getThreadNum; external core_lib name '?getThreadNum@cv@@YAHXZ'; -function getTickCount; external core_lib name '?getTickCount@cv@@YA_JXZ'; -function getTickFrequency; external core_lib name '?getTickFrequency@cv@@YANXZ'; -function getCPUTickCount; external core_lib name '?getCPUTickCount@cv@@YA_JXZ'; -function checkHardwareSupport; external core_lib name '?checkHardwareSupport@cv@@YA_NH@Z'; -function getNumberOfCPUs; external core_lib name '?getNumberOfCPUs@cv@@YAHXZ'; -function fastMalloc; external core_lib name '?fastMalloc@cv@@YAPAXI@Z'; -procedure fastFree; external core_lib name '?fastFree@cv@@YAXPAX@Z'; -procedure setUseOptimized; external core_lib name '?setUseOptimized@cv@@YAX_N@Z'; -function useOptimized; external core_lib name '?useOptimized@cv@@YA_NXZ'; +function setBreakOnError(flag: cbool): cbool; cdecl; external core_lib name '?setBreakOnError@cv@@YA_N_N@Z'; +function redirectError(errCallback: TErrorCallback; userdata: pointer = nil; prevUserdata: PPointer = nil): TErrorCallback; cdecl; external core_lib name '?redirectError@cv@@YAP6AHHPBD00HPAX@ZP6AHH000H1@Z1PAPAX@Z'; +procedure setNumThreads(nthreads: integer); cdecl; external core_lib name '?setNumThreads@cv@@YAXH@Z'; +function getNumThreads(): integer; cdecl; external core_lib name '?getNumThreads@cv@@YAHXZ'; +function getThreadNum(): integer; cdecl; external core_lib name '?getThreadNum@cv@@YAHXZ'; +function getTickCount(): int64; cdecl; external core_lib name '?getTickCount@cv@@YA_JXZ'; +function getTickFrequency(): double; cdecl; external core_lib name '?getTickFrequency@cv@@YANXZ'; +function getCPUTickCount(): int64; cdecl; external core_lib name '?getCPUTickCount@cv@@YA_JXZ'; +function checkHardwareSupport(feature: integer): cbool; cdecl; external core_lib name '?checkHardwareSupport@cv@@YA_NH@Z'; +function getNumberOfCPUs(): integer; cdecl; external core_lib name '?getNumberOfCPUs@cv@@YAHXZ'; +function fastMalloc(bufSize: size_t): pointer; cdecl; external core_lib name '?fastMalloc@cv@@YAPAXI@Z'; +procedure fastFree(ptr: pointer); cdecl; external core_lib name '?fastFree@cv@@YAXPAX@Z'; +procedure setUseOptimized(onoff: cbool); cdecl; external core_lib name '?setUseOptimized@cv@@YAX_N@Z'; +function useOptimized(): cbool; cdecl; external core_lib name '?useOptimized@cv@@YA_NXZ'; {$ENDIF} { TSize } diff --git a/source/component/ocv.comp.Types.pas b/source/component/ocv.comp.Types.pas index 58ea6be..e6bdd5f 100644 --- a/source/component/ocv.comp.Types.pas +++ b/source/component/ocv.comp.Types.pas @@ -91,9 +91,9 @@ const Type {$IFDEF DELPHIXE_UP} - TocvRects = TArray<TocvRect>; - TocvCircles = TArray<TocvCircle>; - TocvLines = TArray<TocvLine>; + TocvRects = {$IFDEF FPC}specialize {$ENDIF}TArray<TocvRect>; + TocvCircles = {$IFDEF FPC}specialize {$ENDIF}TArray<TocvCircle>; + TocvLines = {$IFDEF FPC}specialize {$ENDIF}TArray<TocvLine>; {$ELSE} TocvRects = Array of TocvRect; TocvCircles = Array of TocvCircle; diff --git a/source/ocv.calib3d_c.pas b/source/ocv.calib3d_c.pas index 2160178..4568680 100644 --- a/source/ocv.calib3d_c.pas +++ b/source/ocv.calib3d_c.pas @@ -95,14 +95,14 @@ function cvCreatePOSITObject(points: pCvPoint3D32f; point_count: Integer): PCvPO {$IFDEF SAFELOADLIB} Type - TcvPOSIT = procedure(posit_object: PCvPOSITObject; imagePoints: pCvPoint2D32f; focal_length: double; criteria: TCvTermCriteria; - rotation_matrix: TCvMatr32f; translation_vector: TCvVect32f); cdecl; + TcvPOSIT = procedure(posit_object: PCvPOSITObject; imagePoints: pCvPoint2D32f; focal_length: double; criteria: TCvTermCriteria; rotation_matrix: TCvMatr32f; + translation_vector: TCvVect32f); cdecl; var cvPOSIT: TcvPOSIT; {$ELSE} -procedure cvPOSIT(posit_object: PCvPOSITObject; imagePoints: pCvPoint2D32f; focal_length: double; criteria: TCvTermCriteria; - rotation_matrix: TCvMatr32f; translation_vector: TCvVect32f); cdecl; +procedure cvPOSIT(posit_object: PCvPOSITObject; imagePoints: pCvPoint2D32f; focal_length: double; criteria: TCvTermCriteria; rotation_matrix: TCvMatr32f; + translation_vector: TCvVect32f); cdecl; {$ENDIF} (* Releases CvPOSITObject structure @@ -151,17 +151,17 @@ const CV_FM_7POINT = 1; CV_FM_8POINT = 2; - CV_LMEDS = 4; + CV_LMEDS = 4; CV_RANSAC = 8; - CV_FM_LMEDS_ONLY = CV_LMEDS; + CV_FM_LMEDS_ONLY = CV_LMEDS; CV_FM_RANSAC_ONLY = CV_RANSAC; - CV_FM_LMEDS = CV_LMEDS; - CV_FM_RANSAC = CV_RANSAC; + CV_FM_LMEDS = CV_LMEDS; + CV_FM_RANSAC = CV_RANSAC; CV_ITERATIVE = 0; - CV_EPNP = 1; // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" - CV_P3P = 2; + CV_EPNP = 1; // F.Moreno-Noguer, V.Lepetit and P.Fua "EPnP: Efficient Perspective-n-Point Camera Pose Estimation" + CV_P3P = 2; // X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem" (* @@ -174,14 +174,14 @@ const {$IFDEF SAFELOADLIB} Type - TcvFindFundamentalMat = function(const points1: pCvMat; const points2: pCvMat; fundamental_matrix: pCvMat; method: Integer = CV_FM_RANSAC; - param1: double = 3; param2: double = 0.99; status: pCvMat = nil): Integer; cdecl; + TcvFindFundamentalMat = function(const points1: pCvMat; const points2: pCvMat; fundamental_matrix: pCvMat; method: Integer = CV_FM_RANSAC; param1: double = 3; + param2: double = 0.99; status: pCvMat = nil): Integer; cdecl; Var cvFindFundamentalMat: TcvFindFundamentalMat; {$ELSE} -function cvFindFundamentalMat(const points1: pCvMat; const points2: pCvMat; fundamental_matrix: pCvMat; method: Integer = CV_FM_RANSAC; - param1: double = 3; param2: double = 0.99; status: pCvMat = nil): Integer; cdecl; +function cvFindFundamentalMat(const points1: pCvMat; const points2: pCvMat; fundamental_matrix: pCvMat; method: Integer = CV_FM_RANSAC; param1: double = 3; + param2: double = 0.99; status: pCvMat = nil): Integer; cdecl; {$ENDIF} (* For each input point on one of images @@ -196,14 +196,12 @@ function cvFindFundamentalMat(const points1: pCvMat; const points2: pCvMat; fund {$IFDEF SAFELOADLIB} Type - TcvComputeCorrespondEpilines = procedure(const points: pCvMat; which_image: Integer; const fundamental_matrix: pCvMat; - correspondent_lines: pCvMat); cdecl; + TcvComputeCorrespondEpilines = procedure(const points: pCvMat; which_image: Integer; const fundamental_matrix: pCvMat; correspondent_lines: pCvMat); cdecl; var cvComputeCorrespondEpilines: TcvComputeCorrespondEpilines; {$ELSE} -procedure cvComputeCorrespondEpilines(const points: pCvMat; which_image: Integer; const fundamental_matrix: pCvMat; - correspondent_lines: pCvMat); cdecl; +procedure cvComputeCorrespondEpilines(const points: pCvMat; which_image: Integer; const fundamental_matrix: pCvMat; correspondent_lines: pCvMat); cdecl; {$ENDIF} (* Triangulation functions @@ -259,9 +257,8 @@ Type var cvGetOptimalNewCameraMatrix: TcvGetOptimalNewCameraMatrix; {$ELSE} -procedure cvGetOptimalNewCameraMatrix(const camera_matrix: pCvMat; const dist_coeffs: pCvMat; image_size: TCvSize; alpha: double; - new_camera_matrix: pCvMat; new_imag_size: TCvSize { = CV_DEFAULT(cvSize(0,0))) }; valid_pixel_ROI: PCvRect = nil; - center_principal_point: Integer = 0); cdecl; +procedure cvGetOptimalNewCameraMatrix(const camera_matrix: pCvMat; const dist_coeffs: pCvMat; image_size: TCvSize; alpha: double; new_camera_matrix: pCvMat; + new_imag_size: TCvSize { = CV_DEFAULT(cvSize(0,0))) }; valid_pixel_ROI: PCvRect = nil; center_principal_point: Integer = 0); cdecl; {$ENDIF} (* Converts rotation vector to rotation matrix or vice versa @@ -292,14 +289,14 @@ function cvRodrigues2(const src: pCvMat; dst: pCvMat; jacobian: pCvMat = nil): I {$IFDEF SAFELOADLIB} type - TcvFindHomography = function(const src_points: pCvMat; const dst_points: pCvMat; homography: pCvMat; method: Integer = 0; - ransacReprojThreshold: double = 3; mask: pCvMat = nil): Integer; cdecl; + TcvFindHomography = function(const src_points: pCvMat; const dst_points: pCvMat; homography: pCvMat; method: Integer = 0; ransacReprojThreshold: double = 3; + mask: pCvMat = nil): Integer; cdecl; Var cvFindHomography: TcvFindHomography; {$ELSE} -function cvFindHomography(const src_points: pCvMat; const dst_points: pCvMat; homography: pCvMat; method: Integer = 0; - ransacReprojThreshold: double = 3; mask: pCvMat = nil): Integer; cdecl; +function cvFindHomography(const src_points: pCvMat; const dst_points: pCvMat; homography: pCvMat; method: Integer = 0; ransacReprojThreshold: double = 3; + mask: pCvMat = nil): Integer; cdecl; {$ENDIF} (* Computes RQ decomposition for 3x3 matrices @@ -313,14 +310,14 @@ function cvFindHomography(const src_points: pCvMat; const dst_points: pCvMat; ho {$IFDEF SAFELOADLIB} type - TcvRQDecomp3x3 = procedure(const matrixM: pCvMat; matrixR: pCvMat; matrixQ: pCvMat; matrixQx: pCvMat = nil; matrixQy: pCvMat = nil; - matrixQz: pCvMat = nil; eulerAngles: PCvPoint3D64f = nil); cdecl; + TcvRQDecomp3x3 = procedure(const matrixM: pCvMat; matrixR: pCvMat; matrixQ: pCvMat; matrixQx: pCvMat = nil; matrixQy: pCvMat = nil; matrixQz: pCvMat = nil; + eulerAngles: PCvPoint3D64f = nil); cdecl; Var cvRQDecomp3x3: TcvRQDecomp3x3; {$ELSE} -procedure cvRQDecomp3x3(const matrixM: pCvMat; matrixR: pCvMat; matrixQ: pCvMat; matrixQx: pCvMat = nil; matrixQy: pCvMat = nil; - matrixQz: pCvMat = nil; eulerAngles: PCvPoint3D64f = nil); cdecl; +procedure cvRQDecomp3x3(const matrixM: pCvMat; matrixR: pCvMat; matrixQ: pCvMat; matrixQx: pCvMat = nil; matrixQy: pCvMat = nil; matrixQz: pCvMat = nil; + eulerAngles: PCvPoint3D64f = nil); cdecl; {$ENDIF} (* Computes projection matrix decomposition @@ -375,15 +372,15 @@ procedure cvCalcMatMulDeriv(const A: pCvMat; const B: pCvMat; dABdA: pCvMat; dAB type TcvComposeRT = procedure(const _rvec1: pCvMat; const _tvec1: pCvMat; const _rvec2: pCvMat; const _tvec2: pCvMat; _rvec3: pCvMat; _tvec3: pCvMat; - dr3dr1: pCvMat = nil; dr3dt1: pCvMat = nil; dr3dr2: pCvMat = nil; dr3dt2: pCvMat = nil; dt3dr1: pCvMat = nil; dt3dt1: pCvMat = nil; - dt3dr2: pCvMat = nil; dt3dt2: pCvMat = nil); cdecl; + dr3dr1: pCvMat = nil; dr3dt1: pCvMat = nil; dr3dr2: pCvMat = nil; dr3dt2: pCvMat = nil; dt3dr1: pCvMat = nil; dt3dt1: pCvMat = nil; dt3dr2: pCvMat = nil; + dt3dt2: pCvMat = nil); cdecl; var cvComposeRT: TcvComposeRT; {$ELSE} procedure cvComposeRT(const _rvec1: pCvMat; const _tvec1: pCvMat; const _rvec2: pCvMat; const _tvec2: pCvMat; _rvec3: pCvMat; _tvec3: pCvMat; - dr3dr1: pCvMat = nil; dr3dt1: pCvMat = nil; dr3dr2: pCvMat = nil; dr3dt2: pCvMat = nil; dt3dr1: pCvMat = nil; dt3dt1: pCvMat = nil; - dt3dr2: pCvMat = nil; dt3dt2: pCvMat = nil); cdecl; + dr3dr1: pCvMat = nil; dr3dt1: pCvMat = nil; dr3dr2: pCvMat = nil; dr3dt2: pCvMat = nil; dt3dr1: pCvMat = nil; dt3dt1: pCvMat = nil; dt3dr2: pCvMat = nil; + dt3dt2: pCvMat = nil); cdecl; {$ENDIF} (* Projects object points to the view plane using @@ -400,9 +397,9 @@ procedure cvComposeRT(const _rvec1: pCvMat; const _tvec1: pCvMat; const _rvec2: {$IFDEF SAFELOADLIB} type - TcvProjectPoints2 = procedure(const object_points: pCvMat; const rotation_vector: pCvMat; const translation_vector: pCvMat; - const camera_matrix: pCvMat; const distortion_coeffs: pCvMat; image_points: pCvMat; dpdrot: pCvMat = nil; dpdt: pCvMat = nil; dpdf: pCvMat = nil; - dpdc: pCvMat = nil; dpddist: pCvMat = nil; aspect_ratio: double = 0); cdecl; + TcvProjectPoints2 = procedure(const object_points: pCvMat; const rotation_vector: pCvMat; const translation_vector: pCvMat; const camera_matrix: pCvMat; + const distortion_coeffs: pCvMat; image_points: pCvMat; dpdrot: pCvMat = nil; dpdt: pCvMat = nil; dpdf: pCvMat = nil; dpdc: pCvMat = nil; + dpddist: pCvMat = nil; aspect_ratio: double = 0); cdecl; var cvProjectPoints2: TcvProjectPoints2; @@ -431,8 +428,8 @@ type var cvFindExtrinsicCameraParams2: TcvFindExtrinsicCameraParams2; {$ELSE} -procedure cvFindExtrinsicCameraParams2(const object_points: pCvMat; const image_points: pCvMat; const camera_matrix: pCvMat; - const distortion_coeffs: pCvMat; rotation_vector: pCvMat; translation_vector: pCvMat; use_extrinsic_guess: Integer = 0); cdecl; +procedure cvFindExtrinsicCameraParams2(const object_points: pCvMat; const image_points: pCvMat; const camera_matrix: pCvMat; const distortion_coeffs: pCvMat; + rotation_vector: pCvMat; translation_vector: pCvMat; use_extrinsic_guess: Integer = 0); cdecl; {$ENDIF} (* Computes initial estimate of the intrinsic camera parameters in case of planar calibration target (e.g. chessboard) @@ -453,15 +450,15 @@ Type var cvInitIntrinsicParams2D: TcvInitIntrinsicParams2D; {$ELSE} -procedure cvInitIntrinsicParams2D(const object_points: pCvMat; const image_points: pCvMat; const npoints: pCvMat; image_size: TCvSize; - camera_matrix: pCvMat; aspect_ratio: double = 1); cdecl; +procedure cvInitIntrinsicParams2D(const object_points: pCvMat; const image_points: pCvMat; const npoints: pCvMat; image_size: TCvSize; camera_matrix: pCvMat; + aspect_ratio: double = 1); cdecl; {$ENDIF} const CV_CALIB_CB_ADAPTIVE_THRESH = 1; CV_CALIB_CB_NORMALIZE_IMAGE = 2; - CV_CALIB_CB_FILTER_QUADS = 4; - CV_CALIB_CB_FAST_CHECK = 8; + CV_CALIB_CB_FILTER_QUADS = 4; + CV_CALIB_CB_FAST_CHECK = 8; (* Performs a fast check if a chessboard is in the input image. This is a workaround to a problem of cvFindChessboardCorners being slow on images with no chessboard @@ -507,19 +504,19 @@ function cvFindChessboardCorners(const image: Pointer; pattern_size: TCvSize; co const CV_CALIB_USE_INTRINSIC_GUESS = 1; - CV_CALIB_FIX_ASPECT_RATIO = 2; + CV_CALIB_FIX_ASPECT_RATIO = 2; CV_CALIB_FIX_PRINCIPAL_POINT = 4; - CV_CALIB_ZERO_TANGENT_DIST = 8; - CV_CALIB_FIX_FOCAL_LENGTH = 16; - CV_CALIB_FIX_K1 = 32; - CV_CALIB_FIX_K2 = 64; - CV_CALIB_FIX_K3 = 128; - CV_CALIB_FIX_K4 = 2048; - CV_CALIB_FIX_K5 = 4096; - CV_CALIB_FIX_K6 = 8192; - CV_CALIB_RATIONAL_MODEL = 16384; - CV_CALIB_THIN_PRISM_MODEL = 32768; - CV_CALIB_FIX_S1_S2_S3_S4 = 65536; + CV_CALIB_ZERO_TANGENT_DIST = 8; + CV_CALIB_FIX_FOCAL_LENGTH = 16; + CV_CALIB_FIX_K1 = 32; + CV_CALIB_FIX_K2 = 64; + CV_CALIB_FIX_K3 = 128; + CV_CALIB_FIX_K4 = 2048; + CV_CALIB_FIX_K5 = 4096; + CV_CALIB_FIX_K6 = 8192; + CV_CALIB_RATIONAL_MODEL = 16384; + CV_CALIB_THIN_PRISM_MODEL = 32768; + CV_CALIB_FIX_S1_S2_S3_S4 = 65536; (* Draws individual chessboard corners or the whole chessboard detected @@ -534,8 +531,7 @@ const {$IFDEF SAFELOADLIB} type - TcvDrawChessboardCorners = procedure(image: pIplImage; pattern_size: TCvSize; corners: pCvPoint2D32f; count: Integer; - pattern_was_found: Integer); cdecl; + TcvDrawChessboardCorners = procedure(image: pIplImage; pattern_size: TCvSize; corners: pCvPoint2D32f; count: Integer; pattern_was_found: Integer); cdecl; var cvDrawChessboardCorners: TcvDrawChessboardCorners; @@ -606,19 +602,17 @@ function cvCalibrateCamera2( type TcvCalibrationMatrixValues = procedure(const camera_matrix: pCvMat; image_size: TCvSize; aperture_width: double = 0; aperture_height: double = 0; - fovx: PDouble = nil; fovy: PDouble = nil; focal_length: PDouble = nil; principal_point: PCvPoint2D64f = nil; - pixel_aspect_ratio: PDouble = nil); cdecl; + fovx: PDouble = nil; fovy: PDouble = nil; focal_length: PDouble = nil; principal_point: PCvPoint2D64f = nil; pixel_aspect_ratio: PDouble = nil); cdecl; Var cvCalibrationMatrixValues: TcvCalibrationMatrixValues; {$ELSE} procedure cvCalibrationMatrixValues(const camera_matrix: pCvMat; image_size: TCvSize; aperture_width: double = 0; aperture_height: double = 0; - fovx: PDouble = nil; fovy: PDouble = nil; focal_length: PDouble = nil; principal_point: PCvPoint2D64f = nil; - pixel_aspect_ratio: PDouble = nil); cdecl; + fovx: PDouble = nil; fovy: PDouble = nil; focal_length: PDouble = nil; principal_point: PCvPoint2D64f = nil; pixel_aspect_ratio: PDouble = nil); cdecl; {$ENDIF} const - CV_CALIB_FIX_INTRINSIC = 256; + CV_CALIB_FIX_INTRINSIC = 256; CV_CALIB_SAME_FOCAL_LENGTH = 512; (* Computes the transformation from one camera coordinate system to another one @@ -639,17 +633,16 @@ const type TcvStereoCalibrate = function(const object_points: pCvMat; const image_points1: pCvMat; const image_points2: pCvMat; const npoints: pCvMat; - camera_matrix1: pCvMat; dist_coeffs1: pCvMat; camera_matrix2: pCvMat; dist_coeffs2: pCvMat; image_size: TCvSize; R: pCvMat; T: pCvMat; - E: pCvMat { = nil }; F: pCvMat { = nil }; - term_crit: TCvTermCriteria { = CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 30, 1E-6)) }; + camera_matrix1: pCvMat; dist_coeffs1: pCvMat; camera_matrix2: pCvMat; dist_coeffs2: pCvMat; image_size: TCvSize; R: pCvMat; T: pCvMat; E: pCvMat { = nil }; + F: pCvMat { = nil }; term_crit: TCvTermCriteria { = CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 30, 1E-6)) }; flags: Integer { = CV_DEFAULT(CV_CALIB_FIX_INTRINSIC) } ): double; cdecl; var cvStereoCalibrate: TcvStereoCalibrate; {$ELSE} -function cvStereoCalibrate(const object_points: pCvMat; const image_points1: pCvMat; const image_points2: pCvMat; const npoints: pCvMat; - camera_matrix1: pCvMat; dist_coeffs1: pCvMat; camera_matrix2: pCvMat; dist_coeffs2: pCvMat; image_size: TCvSize; R: pCvMat; T: pCvMat; - E: pCvMat { = nil }; F: pCvMat { = nil }; term_crit: TCvTermCriteria { = CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 30, 1E-6)) }; +function cvStereoCalibrate(const object_points: pCvMat; const image_points1: pCvMat; const image_points2: pCvMat; const npoints: pCvMat; camera_matrix1: pCvMat; + dist_coeffs1: pCvMat; camera_matrix2: pCvMat; dist_coeffs2: pCvMat; image_size: TCvSize; R: pCvMat; T: pCvMat; E: pCvMat { = nil }; F: pCvMat { = nil }; + term_crit: TCvTermCriteria { = CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 30, 1E-6)) }; flags: Integer { = CV_DEFAULT(CV_CALIB_FIX_INTRINSIC) } ): double; cdecl; {$ENDIF} @@ -684,8 +677,8 @@ var {$ELSE} procedure cvStereoRectify(const camera_matrix1: pCvMat; const camera_matrix2: pCvMat; const dist_coeffs1: pCvMat; const dist_coeffs2: pCvMat; image_size: TCvSize; const R: pCvMat; const T: pCvMat; R1: pCvMat; R2: pCvMat; P1: pCvMat; P2: pCvMat; Q: pCvMat { = nil }; - flags: Integer { = CV_CALIB_ZERO_DISPARITY }; alpha: double { = -1 }; new_image_size: TCvSize { =CV_DEFAULT(cvSize(0,0)) }; - valid_pix_ROI1: PCvRect { =nil }; valid_pix_ROI2: PCvRect { =nil } ); cdecl; + flags: Integer { = CV_CALIB_ZERO_DISPARITY }; alpha: double { = -1 }; new_image_size: TCvSize { =CV_DEFAULT(cvSize(0,0)) }; valid_pix_ROI1: PCvRect { =nil }; + valid_pix_ROI2: PCvRect { =nil } ); cdecl; {$ENDIF} (* Computes rectification transformations for uncalibrated pair of images using a set @@ -712,7 +705,7 @@ function cvStereoRectifyUncalibrated(const points1: pCvMat; const points2: pCvMa (* stereo correspondence parameters and functions *) const CV_STEREO_BM_NORMALIZED_RESPONSE = 0; - CV_STEREO_BM_XSOBEL = 1; + CV_STEREO_BM_XSOBEL = 1; Type (* Block matching algorithm structure *) @@ -757,11 +750,11 @@ Type // pre-filtering (normalization of input images) preFilterType: Integer; // =CV_STEREO_BM_NORMALIZED_RESPONSE now preFilterSize: Integer; // averaging window size: ~5x5..21x21 - preFilterCap: Integer; // the output of pre-filtering is clipped by [-preFilterCap,preFilterCap] + preFilterCap: Integer; // the output of pre-filtering is clipped by [-preFilterCap,preFilterCap] // correspondence using Sum of Absolute Difference (SAD) - SADWindowSize: Integer; // ~5x5..21x21 - minDisparity: Integer; // minimum disparity (can be negative) + SADWindowSize: Integer; // ~5x5..21x21 + minDisparity: Integer; // minimum disparity (can be negative) numberOfDisparities: Integer; // maximum disparity - minimum disparity (> 0) // post-filtering @@ -771,7 +764,7 @@ Type // SAD(d) >= SAD(d*)*(1 + uniquenessRatio/100.) // for any d != d*+/-1 within the search range. speckleWindowSize: Integer; // disparity variation window - speckleRange: Integer; // acceptable range of variation in window + speckleRange: Integer; // acceptable range of variation in window trySmallerWindows: Integer; // if 1, the results may be more accurate, // at the expense of slower processing @@ -787,9 +780,9 @@ Type end; const - CV_STEREO_BM_BASIC = 0; + CV_STEREO_BM_BASIC = 0; CV_STEREO_BM_FISH_EYE = 1; - CV_STEREO_BM_NARROW = 2; + CV_STEREO_BM_NARROW = 2; (* CVAPI(CvStereoBMState* ) cvCreateStereoBMState(int preset CV_DEFAULT(CV_STEREO_BM_BASIC), @@ -839,14 +832,12 @@ procedure cvFindStereoCorrespondenceBM(const left: pCvArr; const right: pCvArr; {$IFDEF SAFELOADLIB} type - TcvGetValidDisparityROI = function(roi1: TCvRect; roi2: TCvRect; minDisparity: Integer; numberOfDisparities: Integer; SADWindowSize: Integer) - : TCvRect; cdecl; + TcvGetValidDisparityROI = function(roi1: TCvRect; roi2: TCvRect; minDisparity: Integer; numberOfDisparities: Integer; SADWindowSize: Integer): TCvRect; cdecl; var cvGetValidDisparityROI: TcvGetValidDisparityROI; {$ELSE} -function cvGetValidDisparityROI(roi1: TCvRect; roi2: TCvRect; minDisparity: Integer; numberOfDisparities: Integer; SADWindowSize: Integer) - : TCvRect; cdecl; +function cvGetValidDisparityROI(roi1: TCvRect; roi2: TCvRect; minDisparity: Integer; numberOfDisparities: Integer; SADWindowSize: Integer): TCvRect; cdecl; {$ENDIF} (* CVAPI(void) cvValidateDisparity( CvArr* disparity, const CvArr* cost, @@ -862,8 +853,7 @@ type var cvValidateDisparity: TcvValidateDisparity; {$ELSE} -procedure cvValidateDisparity(disparity: pCvArr; const cost: pCvArr; minDisparity: Integer; numberOfDisparities: Integer; - disp12MaxDiff: Integer = 1); cdecl; +procedure cvValidateDisparity(disparity: pCvArr; const cost: pCvArr; minDisparity: Integer; numberOfDisparities: Integer; disp12MaxDiff: Integer = 1); cdecl; {$ENDIF} (* Reprojects the computed disparity image to the 3D space using the specified 4x4 matrix @@ -953,39 +943,69 @@ initialization Init_opencv_calib3d_lib; {$ELSE} -function cvCreatePOSITObject; external calib3d_lib; -procedure cvPOSIT; external calib3d_lib; -procedure cvReleasePOSITObject; external calib3d_lib; -function cvRANSACUpdateNumIters; external calib3d_lib; -procedure cvConvertPointsHomogeneous; external calib3d_lib; -function cvFindFundamentalMat; external calib3d_lib; -procedure cvComputeCorrespondEpilines; external calib3d_lib; -procedure cvTriangulatePoints; external calib3d_lib; -procedure cvCorrectMatches; external calib3d_lib; -procedure cvGetOptimalNewCameraMatrix; external calib3d_lib; -function cvRodrigues2; external calib3d_lib; -function cvFindHomography; external calib3d_lib; -procedure cvRQDecomp3x3; external calib3d_lib; -procedure cvDecomposeProjectionMatrix; external calib3d_lib; -procedure cvCalcMatMulDeriv; external calib3d_lib; -procedure cvComposeRT; external calib3d_lib; -procedure cvProjectPoints2; external calib3d_lib; -procedure cvFindExtrinsicCameraParams2; external calib3d_lib; -procedure cvInitIntrinsicParams2D; external calib3d_lib; -function cvCheckChessboard; external calib3d_lib; -function cvFindChessboardCorners; external calib3d_lib; -procedure cvDrawChessboardCorners; external calib3d_lib; -function cvCalibrateCamera2; external calib3d_lib; -procedure cvCalibrationMatrixValues; external calib3d_lib; -function cvStereoCalibrate; external calib3d_lib; -procedure cvStereoRectify; external calib3d_lib; -function cvStereoRectifyUncalibrated; external calib3d_lib; -function cvCreateStereoBMState; external calib3d_lib; -procedure cvReleaseStereoBMState; external calib3d_lib; -procedure cvFindStereoCorrespondenceBM; external calib3d_lib; -function cvGetValidDisparityROI; external calib3d_lib; -procedure cvValidateDisparity; external calib3d_lib; -procedure cvReprojectImageTo3D; external calib3d_lib; +function cvCreatePOSITObject(points: pCvPoint3D32f; point_count: Integer): PCvPOSITObject; cdecl; external calib3d_lib; +procedure cvPOSIT(posit_object: PCvPOSITObject; imagePoints: pCvPoint2D32f; focal_length: double; criteria: TCvTermCriteria; rotation_matrix: TCvMatr32f; + translation_vector: TCvVect32f); cdecl; external calib3d_lib; +procedure cvReleasePOSITObject(Var posit_object: PCvPOSITObject); cdecl; external calib3d_lib; +function cvRANSACUpdateNumIters(p: double; err_prob: double; model_points: Integer; max_iters: Integer): Integer; cdecl; external calib3d_lib; +procedure cvConvertPointsHomogeneous(const src: pCvMat; dst: pCvMat); cdecl; external calib3d_lib; +function cvFindFundamentalMat(const points1: pCvMat; const points2: pCvMat; fundamental_matrix: pCvMat; method: Integer = CV_FM_RANSAC; param1: double = 3; + param2: double = 0.99; status: pCvMat = nil): Integer; cdecl; external calib3d_lib; +procedure cvComputeCorrespondEpilines(const points: pCvMat; which_image: Integer; const fundamental_matrix: pCvMat; correspondent_lines: pCvMat); cdecl; + external calib3d_lib; +procedure cvTriangulatePoints(projMatr1: pCvMat; projMatr2: pCvMat; projPoints1: pCvMat; projPoints2: pCvMat; points4D: pCvMat); cdecl; external calib3d_lib; +procedure cvCorrectMatches(F: pCvMat; points1: pCvMat; points2: pCvMat; new_points1: pCvMat; new_points2: pCvMat); cdecl; external calib3d_lib; +procedure cvGetOptimalNewCameraMatrix(const camera_matrix: pCvMat; const dist_coeffs: pCvMat; image_size: TCvSize; alpha: double; new_camera_matrix: pCvMat; + new_imag_size: TCvSize { = CV_DEFAULT(cvSize(0,0))) }; valid_pixel_ROI: PCvRect = nil; center_principal_point: Integer = 0); cdecl; external calib3d_lib; +function cvRodrigues2(const src: pCvMat; dst: pCvMat; jacobian: pCvMat = nil): Integer; cdecl; external calib3d_lib; +function cvFindHomography(const src_points: pCvMat; const dst_points: pCvMat; homography: pCvMat; method: Integer = 0; ransacReprojThreshold: double = 3; + mask: pCvMat = nil): Integer; cdecl; external calib3d_lib; +procedure cvRQDecomp3x3(const matrixM: pCvMat; matrixR: pCvMat; matrixQ: pCvMat; matrixQx: pCvMat = nil; matrixQy: pCvMat = nil; matrixQz: pCvMat = nil; + eulerAngles: PCvPoint3D64f = nil); cdecl; external calib3d_lib; +procedure cvDecomposeProjectionMatrix(const projMatr: pCvMat; calibMatr: pCvMat; rotMatr: pCvMat; posVect: pCvMat; rotMatrX: pCvMat = nil; + rotMatrY: pCvMat = nil; rotMatrZ: pCvMat = nil; eulerAngles: PCvPoint3D64f = nil); cdecl; external calib3d_lib; +procedure cvCalcMatMulDeriv(const A: pCvMat; const B: pCvMat; dABdA: pCvMat; dABdB: pCvMat); cdecl; external calib3d_lib; +procedure cvComposeRT(const _rvec1: pCvMat; const _tvec1: pCvMat; const _rvec2: pCvMat; const _tvec2: pCvMat; _rvec3: pCvMat; _tvec3: pCvMat; + dr3dr1: pCvMat = nil; dr3dt1: pCvMat = nil; dr3dr2: pCvMat = nil; dr3dt2: pCvMat = nil; dt3dr1: pCvMat = nil; dt3dt1: pCvMat = nil; dt3dr2: pCvMat = nil; + dt3dt2: pCvMat = nil); cdecl; external calib3d_lib; +procedure cvProjectPoints2(const object_points: pCvMat; const rotation_vector: pCvMat; const translation_vector: pCvMat; const camera_matrix: pCvMat; + const distortion_coeffs: pCvMat; image_points: pCvMat; dpdrot: pCvMat = nil; dpdt: pCvMat = nil; dpdf: pCvMat = nil; dpdc: pCvMat = nil; + dpddist: pCvMat = nil; aspect_ratio: double = 0); cdecl; external calib3d_lib; +procedure cvFindExtrinsicCameraParams2(const object_points: pCvMat; const image_points: pCvMat; const camera_matrix: pCvMat; const distortion_coeffs: pCvMat; + rotation_vector: pCvMat; translation_vector: pCvMat; use_extrinsic_guess: Integer = 0); cdecl; external calib3d_lib; +procedure cvInitIntrinsicParams2D(const object_points: pCvMat; const image_points: pCvMat; const npoints: pCvMat; image_size: TCvSize; camera_matrix: pCvMat; + aspect_ratio: double = 1); cdecl; external calib3d_lib; +function cvCheckChessboard(const image: pCvArr; size: TCvSize): Integer; cdecl; external calib3d_lib; +function cvFindChessboardCorners(const image: Pointer; pattern_size: TCvSize; corners: pCvPoint2D32f; corner_count: pInteger = nil; + flags: Integer = CV_CALIB_CB_ADAPTIVE_THRESH + CV_CALIB_CB_NORMALIZE_IMAGE): Integer; cdecl; external calib3d_lib; +procedure cvDrawChessboardCorners(image: pIplImage; pattern_size: TCvSize; corners: pCvPoint2D32f; count: Integer; pattern_was_found: Integer); cdecl; + external calib3d_lib; +function cvCalibrateCamera2(const object_points: pCvMat; const image_points: pCvMat; const point_counts: pCvMat; image_size: TCvSize; camera_matrix: pCvMat; + distortion_coeffs: pCvMat; rotation_vectors: pCvMat { =nil }; translation_vectors: pCvMat { =nil }; flags: Integer { =0 }; + term_crit: TCvTermCriteria { =cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,30,DBL_EPSILON) } + ): double; cdecl; external calib3d_lib; +procedure cvCalibrationMatrixValues(const camera_matrix: pCvMat; image_size: TCvSize; aperture_width: double = 0; aperture_height: double = 0; + fovx: PDouble = nil; fovy: PDouble = nil; focal_length: PDouble = nil; principal_point: PCvPoint2D64f = nil; pixel_aspect_ratio: PDouble = nil); cdecl; + external calib3d_lib; +function cvStereoCalibrate(const object_points: pCvMat; const image_points1: pCvMat; const image_points2: pCvMat; const npoints: pCvMat; camera_matrix1: pCvMat; + dist_coeffs1: pCvMat; camera_matrix2: pCvMat; dist_coeffs2: pCvMat; image_size: TCvSize; R: pCvMat; T: pCvMat; E: pCvMat { = nil }; F: pCvMat { = nil }; + term_crit: TCvTermCriteria { = CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 30, 1E-6)) }; + flags: Integer { = CV_DEFAULT(CV_CALIB_FIX_INTRINSIC) } ): double; cdecl; external calib3d_lib; +procedure cvStereoRectify(const camera_matrix1: pCvMat; const camera_matrix2: pCvMat; const dist_coeffs1: pCvMat; const dist_coeffs2: pCvMat; + image_size: TCvSize; const R: pCvMat; const T: pCvMat; R1: pCvMat; R2: pCvMat; P1: pCvMat; P2: pCvMat; Q: pCvMat { = nil }; + flags: Integer { = CV_CALIB_ZERO_DISPARITY }; alpha: double { = -1 }; new_image_size: TCvSize { =CV_DEFAULT(cvSize(0,0)) }; valid_pix_ROI1: PCvRect { =nil }; + valid_pix_ROI2: PCvRect { =nil } ); cdecl; external calib3d_lib; +function cvStereoRectifyUncalibrated(const points1: pCvMat; const points2: pCvMat; const F: pCvMat; img_size: TCvSize; H1: pCvMat; H2: pCvMat; + threshold: double = 5): Integer; cdecl; external calib3d_lib; +function cvCreateStereoBMState(preset: Integer = CV_STEREO_BM_BASIC; numberOfDisparities: Integer = 0): pCvStereoBMState; cdecl; external calib3d_lib; +procedure cvReleaseStereoBMState(Var state: pCvStereoBMState); cdecl; external calib3d_lib; +procedure cvFindStereoCorrespondenceBM(const left: pCvArr; const right: pCvArr; disparity: pCvArr; state: pCvStereoBMState); cdecl; external calib3d_lib; +function cvGetValidDisparityROI(roi1: TCvRect; roi2: TCvRect; minDisparity: Integer; numberOfDisparities: Integer; SADWindowSize: Integer): TCvRect; cdecl; + external calib3d_lib; +procedure cvValidateDisparity(disparity: pCvArr; const cost: pCvArr; minDisparity: Integer; numberOfDisparities: Integer; disp12MaxDiff: Integer = 1); cdecl; + external calib3d_lib; +procedure cvReprojectImageTo3D(const disparityImage: pCvMat; _3dImage: pIplImage; const Q: pCvMat; handleMissingValues: Integer = 0); cdecl; + external calib3d_lib; {$ENDIF} end. diff --git a/source/ocv.compat.pas b/source/ocv.compat.pas index 100e8e6..f9c8112 100644 --- a/source/ocv.compat.pas +++ b/source/ocv.compat.pas @@ -914,10 +914,10 @@ procedure CV_INIT_PIXEL_POS(var pos: TCvPixelPosition32f; origin, _step: Integer (* right down *) // #define CV_MOVE_RD( pos, cs ) ( CV_MOVE_RIGHT(pos, cs), CV_MOVE_DOWN(pos, cs)) -(* Move by one pixel relatively to current position with wrapping when the position */ - (* achieves image boundary */ - (* pos - position structure */ - (* cs - number of the image channels */ +(* Move by one pixel relatively to current position with wrapping when the position *) + (* achieves image boundary *) + (* pos - position structure *) + (* cs - number of the image channels *) // (* left *) // #define CV_MOVE_LEFT_WRAP( pos, cs ) \ @@ -1504,8 +1504,8 @@ implementation uses ocv.lib; -const - compat_lib = legacy_lib; +//const +// compat_lib = legacy_lib; procedure CV_INIT_PIXEL_POS(var pos: TCvPixelPosition8u; origin, _step: Integer; roi: TIplROI; _x, _y, orientation: Integer); begin @@ -1647,63 +1647,95 @@ begin end; {$ELSE} -function cvMatArray; external legacy_lib; -function cvMean; external legacy_lib; -function cvSumPixels; external legacy_lib; -procedure cvMean_StdDev; external legacy_lib; -procedure cvmPerspectiveProject; external legacy_lib; -procedure cvFillImage; external legacy_lib; -procedure cvRandSetRange; external legacy_lib; -procedure cvRandInit; external legacy_lib; -procedure cvRand; external legacy_lib; -procedure cvbRand; external legacy_lib; -procedure cvbCartToPolar; external legacy_lib; -procedure cvbFastArctan; external legacy_lib; -procedure cvbSqrt; external legacy_lib; -procedure cvbInvSqrt; external legacy_lib; -procedure cvbReciprocal; external legacy_lib; -procedure cvbFastExp; external legacy_lib; -procedure cvbFastLog; external legacy_lib; -function cvContourBoundingRect; external legacy_lib; -function cvPseudoInverse; external legacy_lib; -procedure cvConvexHull; external legacy_lib; -procedure cvMinAreaRect; external legacy_lib; -procedure cvFitLine3D; external legacy_lib; -procedure cvFitLine2D; external legacy_lib; -procedure cvFitEllipse; external legacy_lib; -procedure cvProject3D; external legacy_lib; -function cvHoughLines; external legacy_lib; -function cvHoughLinesP; external legacy_lib; -function cvHoughLinesSDiv; external legacy_lib; -function cvCalcEMD; external legacy_lib; -procedure cvKMeans; external legacy_lib; -procedure cvStartScanGraph; external legacy_lib; -procedure cvEndScanGraph; external legacy_lib; -procedure cvLineAA; external legacy_lib; -procedure cvCircleAA; external legacy_lib; -procedure cvEllipseAA; external legacy_lib; -procedure cvPolyLineAA; external legacy_lib; -procedure cvUnDistortOnce; external legacy_lib; -procedure cvUnDistortInit; external legacy_lib; -procedure cvUnDistort; external legacy_lib; -procedure cvFindFundamentalMatrix; external legacy_lib; -function cvFindChessBoardCornerGuesses; external legacy_lib; -procedure cvCalibrateCamera; external legacy_lib; -procedure cvCalibrateCamera_64d; external legacy_lib; -procedure cvFindExtrinsicCameraParams; external legacy_lib; -procedure cvFindExtrinsicCameraParams_64d; external legacy_lib; -procedure cvRodrigues; external legacy_lib; -procedure cvProjectPoints; external legacy_lib; -procedure cvProjectPointsSimple; external legacy_lib; -function cvSURFParams; external legacy_lib; -procedure cvExtractSURF; external legacy_lib; +function cvMatArray(rows: Integer; cols: Integer; type_: Integer; count: Integer; data: Pointer = nil): TCvMat; cdecl; external legacy_lib; +function cvMean(const image: PCvArr; const mask: PCvArr = nil): Double; cdecl; external legacy_lib; +function cvSumPixels(const image: PCvArr): Double; cdecl; external legacy_lib; +procedure cvMean_StdDev(const image: PCvArr; mean: PDouble; sdv: PDouble; const mask: PCvArr = nil); cdecl; external legacy_lib; +procedure cvmPerspectiveProject(const mat: PCvMat; const src: PCvArr; dst: PCvArr); cdecl; external legacy_lib; +procedure cvFillImage(mat: PCvArr; color: Double); cdecl; external legacy_lib; +procedure cvRandSetRange(state: pCvRandState; param1: Double; param2: Double; index: Integer = -1); cdecl; external legacy_lib; +procedure cvRandInit(state: pCvRandState; param1: Double; param2: Double; seed: Integer; disttype: Integer = CV_RAND_UNI); cdecl; external legacy_lib; +procedure cvRand(state: pCvRandState; arr: PCvArr); cdecl; external legacy_lib; +procedure cvbRand(state: pCvRandState; dst: PSingle; len: Integer); cdecl; external legacy_lib; +procedure cvbCartToPolar(const y: PSingle; const x: PSingle; Var magnitude: Single; Var angle: Single; len: Integer); cdecl; external legacy_lib; +procedure cvbFastArctan(const y: PSingle; const x: PSingle; Var angle: Single; len: Integer); cdecl; external legacy_lib; +procedure cvbSqrt(const x: PSingle; Var y: Single; len: Integer); cdecl; external legacy_lib; +procedure cvbInvSqrt(const x: PSingle; Var y: Single; len: Integer); cdecl; external legacy_lib; +procedure cvbReciprocal(const x: PSingle; var y: Single; len: Integer); cdecl; external legacy_lib; +procedure cvbFastExp(const x: PSingle; Var y: Double; len: Integer); cdecl; external legacy_lib; +procedure cvbFastLog(const x: PDouble; Var y: Single; len: Integer); cdecl; external legacy_lib; +function cvContourBoundingRect(point_set: Pointer; update: Integer = 0): TCvRect; cdecl; external legacy_lib; +function cvPseudoInverse(const src: PCvArr; dst: PCvArr): Double; cdecl; external legacy_lib; +procedure cvConvexHull(points: PCvPoint; num_points: Integer; bound_rect: PCvRect; orientation: Integer; Var hull: Integer; + Var hullsize: Integer); cdecl; external legacy_lib; +procedure cvMinAreaRect(points: PCvPoint; n: Integer; left: Integer; bottom: Integer; right: Integer; top: Integer; anchor: PCvPoint2D32f; + vect1: PCvPoint2D32f; vect2: PCvPoint2D32f); cdecl; external legacy_lib; +procedure cvFitLine3D(points: PCvPoint3D32f; count: Integer; dist: Integer; param: Pointer; reps: Single; aeps: Single; + Var line: Single); cdecl; external legacy_lib; +procedure cvFitLine2D(points: PCvPoint2D32f; count: Integer; dist: Integer; param: Pointer; reps: Single; aeps: Single; + Var line: Single); cdecl; external legacy_lib; +procedure cvFitEllipse(const points: PCvPoint2D32f; count: Integer; Var box: TCvBox2D); cdecl; external legacy_lib; +procedure cvProject3D(points3D: PCvPoint3D32f; count: Integer; points2D: PCvPoint2D32f; xIndx: Integer = 0; yIndx: Integer = 1); cdecl; external legacy_lib; +function cvHoughLines(image: PCvArr; rho: Double; theta: Double; threshold: Integer; lines: pfloat; linesNumber: Integer): Integer; cdecl; external legacy_lib; +function cvHoughLinesP(image: PCvArr; rho: Double; theta: Double; threshold: Integer; lineLength: Integer; lineGap: Integer; + lines: pInteger; linesNumber: Integer): Integer; cdecl; external legacy_lib; +function cvHoughLinesSDiv(image: PCvArr; rho: Double; srn: Integer; theta: Double; stn: Integer; threshold: Integer; lines: pfloat; + linesNumber: Integer): Integer; cdecl; external legacy_lib; +function cvCalcEMD(const signature1: pfloat; size1: Integer; const signature2: pfloat; size2: Integer; dims: Integer; + dist_type: Integer = CV_DIST_L2; dist_func: TCvDistanceFunction = nil; lower_bound: pfloat = nil; user_param: Pointer = nil) + : float; cdecl; external legacy_lib; +procedure cvKMeans(num_clusters: Integer; Var samples: PSingle; num_samples: Integer; vec_size: Integer; termcrit: TCvTermCriteria; + Var cluster_idx: Integer); cdecl; external legacy_lib; +procedure cvStartScanGraph(graph: PCvGraph; scanner: PCvGraphScanner; vtx: PCvGraphVtx = nil; mask: Integer = CV_GRAPH_ALL_ITEMS); cdecl; external legacy_lib; +procedure cvEndScanGraph(scanner: PCvGraphScanner); cdecl; external legacy_lib; +procedure cvLineAA(img: PCvArr; pt1: TCvPoint; pt2: TCvPoint; color: Double; scale: Integer = 0); cdecl; external legacy_lib; +procedure cvCircleAA(img: PCvArr; center: TCvPoint; radius: Integer; color: Double; scale: Integer = 0); cdecl; external legacy_lib; +procedure cvEllipseAA(img: PCvArr; center: TCvPoint; axes: TCvSize; angle: Double; start_angle: Double; end_angle: Double; color: Double; + scale: Integer = 0); cdecl; external legacy_lib; +procedure cvPolyLineAA(img: PCvArr; Var pts: PCvPoint; Var npts: Integer; contours: Integer; is_closed: Integer; color: Double; + scale: Integer = 0); cdecl; external legacy_lib; +procedure cvUnDistortOnce(const src: PCvArr; dst: PCvArr; const intrinsic_matrix: PSingle; const distortion_coeffs: PSingle; + interpolate: Integer); cdecl; external legacy_lib; +procedure cvUnDistortInit(const src: PCvArr; undistortion_map: PCvArr; const A: PSingle; const k: PSingle; interpolate: Integer); cdecl; external legacy_lib; +procedure cvUnDistort(const src: PCvArr; dst: PCvArr; const undistortion_map: PCvArr; interpolate: Integer); cdecl; external legacy_lib; +procedure cvFindFundamentalMatrix(Var points1: Integer; Var points2: Integer; numpoints: Integer; method: Integer; + Var matrix: Single); cdecl; external legacy_lib; +function cvFindChessBoardCornerGuesses(const arr: Pointer; thresharr: Pointer; storage: PCvMemStorage; pattern_size: TCvSize; + corners: PCvPoint2D32f; corner_count: pInteger): Integer; cdecl; external legacy_lib; +procedure cvCalibrateCamera(image_count: Integer; Var _point_counts: Integer; image_size: TCvSize; _image_points: PCvPoint2D32f; + _object_points: PCvPoint3D32f; _distortion_coeffs: PSingle; _camera_matrix: PSingle; _translation_vectors: PSingle; + _rotation_matrices: PSingle; flags: Integer); cdecl; external legacy_lib; +procedure cvCalibrateCamera_64d(image_count: Integer; Var _point_counts: Integer; image_size: TCvSize; _image_points: PCvPoint2D64f; + _object_points: PCvPoint3D64f; _distortion_coeffs: PDouble; _camera_matrix: PDouble; _translation_vectors: PDouble; + _rotation_matrices: PDouble; flags: Integer); cdecl; external legacy_lib; +procedure cvFindExtrinsicCameraParams(point_count: Integer; image_size: TCvSize; _image_points: PCvPoint2D32f; + _object_points: PCvPoint3D32f; focal_length: PSingle; principal_point: TCvPoint2D32f; _distortion_coeffs: PSingle; + _rotation_vector: PSingle; _translation_vector: PSingle); cdecl; external legacy_lib; +procedure cvFindExtrinsicCameraParams_64d(point_count: Integer; image_size: TCvSize; _image_points: PCvPoint2D64f; + _object_points: PCvPoint3D64f; focal_length: PDouble; principal_point: TCvPoint2D64f; _distortion_coeffs: PDouble; + _rotation_vector: PDouble; _translation_vector: PDouble); cdecl; external legacy_lib; +procedure cvRodrigues(rotation_matrix: PCvMat; rotation_vector: PCvMat; jacobian: PCvMat; conv_type: Integer); cdecl; external legacy_lib; +procedure cvProjectPoints(point_count: Integer; _object_points: PCvPoint3D64f; _rotation_vector: PDouble; _translation_vector: PDouble; + focal_length: PDouble; principal_point: TCvPoint2D64f; _distortion: PDouble; _image_points: PCvPoint2D64f; + _deriv_points_rotation_matrix: PDouble; _deriv_points_translation_vect: PDouble; _deriv_points_focal: PDouble; + _deriv_points_principal_point: PDouble; _deriv_points_distortion_coeffs: PDouble); cdecl; external legacy_lib; +procedure cvProjectPointsSimple(point_count: Integer; _object_points: PCvPoint3D64f; _rotation_matrix: PDouble; + _translation_vector: PDouble; _camera_matrix: PDouble; _distortion: PDouble; _image_points: PCvPoint2D64f); cdecl; external legacy_lib; +function cvSURFParams(hessianThreshold: Double; _extended: Integer = 0): TCvSURFParams; cdecl; external legacy_lib; +procedure cvExtractSURF(const img: PCvArr; const mask: PCvArr; keypoints: ppCvSeq; descriptors: ppCvSeq; storage: PCvMemStorage; + params: TCvSURFParams; useProvidedKeyPts: Integer = 0); cdecl; external legacy_lib; // function cvMSERParams; external legacy_lib; // procedure cvExtractMSER; external legacy_lib; -function cvGetStarKeypoints; external legacy_lib; +function cvGetStarKeypoints(const img: PCvArr; storage: PCvMemStorage; + params: TCvStarDetectorParams { = CV_DEFAULT(cvStarDetectorParams()) } ): pCvSeq; cdecl; external legacy_lib; {$ENDIF} initialization +{$IFDEF SAFELOADLIB} +Init_opencv_legacy_lib; +{$ENDIF} + CV_MAT32F := CV_32FC1; CV_MAT3x1_32F := CV_32FC1; CV_MAT4x1_32F := CV_32FC1; @@ -1716,8 +1748,6 @@ CV_MAT4x1_64D := CV_64FC1; CV_MAT3x3_64D := CV_64FC1; CV_MAT4x4_64D := CV_64FC1; -{$IFDEF SAFELOADLIB} -Init_opencv_legacy_lib; -{$ENDIF} + end. diff --git a/source/ocv.core.types_c.pas b/source/ocv.core.types_c.pas index f988930..567cf3c 100644 --- a/source/ocv.core.types_c.pas +++ b/source/ocv.core.types_c.pas @@ -52,20 +52,21 @@ unit ocv.core.types_c; interface -Uses -{$IFDEF HAS_UNITSCOPE} +(* + Uses + {$IFDEF HAS_UNITSCOPE} Winapi.Windows -{$ELSE} - Windows -{$ENDIF} - ; - + {$ELSE} + Windows + {$ENDIF} + ; +*) const // 1.0+DBL_EPSILON <> 1.0 DBL_EPSILON = 2.2204460492503131E-016; - DBL_MAX = 1.7976931348623157E+308; + DBL_MAX = 1.7976931348623157E+308; FLT_EPSILON = 1.19209290E-07; - FLT_MAX = 1E+37; + FLT_MAX = 1E+37; type cbool = bytebool; @@ -172,57 +173,57 @@ type {$EXTERNALSYM CVStatus} const - CV_StsOk = 0; (* everithing is ok *) - CV_StsBackTrace = -1; (* pseudo error for back trace *) - CV_StsError = -2; (* unknown /unspecified error *) - CV_StsInternal = -3; (* internal error (bad state) *) - CV_StsNoMem = -4; (* insufficient memory *) - CV_StsBadArg = -5; (* function arg/param is bad *) - CV_StsBadFunc = -6; (* unsupported function *) - CV_StsNoConv = -7; (* iter. didn't converge *) - CV_StsAutoTrace = -8; (* tracing *) - CV_HeaderIsNull = -9; (* image header is 0 *) - CV_BadImageSize = -10; (* image size is invalid *) - CV_BadOffset = -11; (* offset is invalid *) - CV_BadDataPtr = -12; (* *) - CV_BadStep = -13; (* *) - CV_BadModelOrChSeq = -14; (* *) - CV_BadNumChannels = -15; (* *) - CV_BadNumChannel1U = -16; (* *) - CV_BadDepth = -17; (* *) - CV_BadAlphaChannel = -18; (* *) - CV_BadOrder = -19; (* *) - CV_BadOrigin = -20; (* *) - CV_BadAlign = -21; (* *) - CV_BadCallBack = -22; (* *) - CV_BadTileSize = -23; (* *) - CV_BadCOI = -24; (* *) - CV_BadROISize = -25; (* *) - CV_MaskIsTiled = -26; (* *) - CV_StsNullPtr = -27; (* null pointer *) - CV_StsVecLengthErr = -28; (* incorrect vector length *) - CV_StsFilterStructContentErr = -29; (* incorr. filter structure content *) - CV_StsKernelStructContentErr = -30; (* incorr. transform kernel content *) - CV_StsFilterOffsetErr = -31; (* incorrect filter ofset value *) - CV_StsBadSize = -201; (* the input/output structure size is incorrect *) - CV_StsDivByZero = -202; (* division by zero *) - CV_StsInplaceNotSupported = -203; (* in-place operation is not supported *) - CV_StsObjectNotFound = -204; (* request can't be completed *) - CV_StsUnmatchedFormats = -205; (* formats of input/output arrays differ *) - CV_StsBadFlag = -206; (* flag is wrong or not supported *) - CV_StsBadPoint = -207; (* bad CvPoint *) - CV_StsBadMask = -208; (* bad format of mask (neither 8uC1 nor 8sC1) *) - CV_StsUnmatchedSizes = -209; (* sizes of input/output structures do not match *) - CV_StsUnsupportedFormat = -210; (* the data format/type is not supported by the function *) - CV_StsOutOfRange = -211; (* some of parameters are out of range *) - CV_StsParseError = -212; (* invalid syntax/structure of the parsed file *) - CV_StsNotImplemented = -213; (* the requested function/feature is not implemented *) - CV_StsBadMemBlock = -214; (* an allocated block has been corrupted *) - CV_StsAssert = -215; (* assertion failed *) - CV_GpuNotSupported = -216; - CV_GpuApiCallError = -217; - CV_OpenGlNotSupported = -218; - CV_OpenGlApiCallError = -219; + CV_StsOk = 0; (* everithing is ok *) + CV_StsBackTrace = -1; (* pseudo error for back trace *) + CV_StsError = -2; (* unknown /unspecified error *) + CV_StsInternal = -3; (* internal error (bad state) *) + CV_StsNoMem = -4; (* insufficient memory *) + CV_StsBadArg = -5; (* function arg/param is bad *) + CV_StsBadFunc = -6; (* unsupported function *) + CV_StsNoConv = -7; (* iter. didn't converge *) + CV_StsAutoTrace = -8; (* tracing *) + CV_HeaderIsNull = -9; (* image header is 0 *) + CV_BadImageSize = -10; (* image size is invalid *) + CV_BadOffset = -11; (* offset is invalid *) + CV_BadDataPtr = -12; (* *) + CV_BadStep = -13; (* *) + CV_BadModelOrChSeq = -14; (* *) + CV_BadNumChannels = -15; (* *) + CV_BadNumChannel1U = -16; (* *) + CV_BadDepth = -17; (* *) + CV_BadAlphaChannel = -18; (* *) + CV_BadOrder = -19; (* *) + CV_BadOrigin = -20; (* *) + CV_BadAlign = -21; (* *) + CV_BadCallBack = -22; (* *) + CV_BadTileSize = -23; (* *) + CV_BadCOI = -24; (* *) + CV_BadROISize = -25; (* *) + CV_MaskIsTiled = -26; (* *) + CV_StsNullPtr = -27; (* null pointer *) + CV_StsVecLengthErr = -28; (* incorrect vector length *) + CV_StsFilterStructContentErr = -29; (* incorr. filter structure content *) + CV_StsKernelStructContentErr = -30; (* incorr. transform kernel content *) + CV_StsFilterOffsetErr = -31; (* incorrect filter ofset value *) + CV_StsBadSize = -201; (* the input/output structure size is incorrect *) + CV_StsDivByZero = -202; (* division by zero *) + CV_StsInplaceNotSupported = -203; (* in-place operation is not supported *) + CV_StsObjectNotFound = -204; (* request can't be completed *) + CV_StsUnmatchedFormats = -205; (* formats of input/output arrays differ *) + CV_StsBadFlag = -206; (* flag is wrong or not supported *) + CV_StsBadPoint = -207; (* bad CvPoint *) + CV_StsBadMask = -208; (* bad format of mask (neither 8uC1 nor 8sC1) *) + CV_StsUnmatchedSizes = -209; (* sizes of input/output structures do not match *) + CV_StsUnsupportedFormat = -210; (* the data format/type is not supported by the function *) + CV_StsOutOfRange = -211; (* some of parameters are out of range *) + CV_StsParseError = -212; (* invalid syntax/structure of the parsed file *) + CV_StsNotImplemented = -213; (* the requested function/feature is not implemented *) + CV_StsBadMemBlock = -214; (* an allocated block has been corrupted *) + CV_StsAssert = -215; (* assertion failed *) + CV_GpuNotSupported = -216; + CV_GpuApiCallError = -217; + CV_OpenGlNotSupported = -218; + CV_OpenGlApiCallError = -219; (* ***************************************************************************************\ * Common macros and functions * @@ -317,17 +318,21 @@ const {$EXTERNALSYM IPL_BORDER_WRAP} // * Sub-pixel interpolation methods */ - CV_INTER_NN = 0; - CV_INTER_LINEAR = 1; - CV_INTER_CUBIC = 2; - CV_INTER_AREA = 3; + CV_INTER_NN = 0; + CV_INTER_LINEAR = 1; + CV_INTER_CUBIC = 2; + CV_INTER_AREA = 3; CV_INTER_LANCZOS4 = 4; type +{$IFDEF FPC} + generic TArray<T> = array of T; +{$ENDIF} + pIplImage = ^TIplImage; TpIplImageArray = array [0 .. 1] of pIplImage; - TArrayOfpIplImage = TArray<pIplImage>; + TArrayOfpIplImage = {$IFDEF FPC}specialize {$ENDIF} TArray<pIplImage>; ppIplImage = ^TpIplImageArray; pIplROI = ^TIplROI; pIplTileInfo = ^TIplTileInfo; @@ -353,29 +358,29 @@ type TA4CVChar = array [0 .. 3] of CVChar; TIplImage = record - nSize: Integer; (* sizeof(IplImage) *) - id: Integer; (* version (=0) *) - nChannels: Integer; (* Most of OpenCV functions support 1,2,3 or 4 channels *) + nSize: Integer; (* sizeof(IplImage) *) + id: Integer; (* version (=0) *) + nChannels: Integer; (* Most of OpenCV functions support 1,2,3 or 4 channels *) alphaChannel: Integer; (* Ignored by OpenCV *) depth: Integer; (* Pixel depth in bits: Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S, IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported. *) - colorModel: TA4CVChar; (* Ignored by OpenCV *) - channelSeq: TA4CVChar; (* ditto *) - dataOrder: Integer; (* 0 - interleaved color channels, 1 - separate color channels. *) - origin: Integer; (* 0 - top-left origin, *) - align: Integer; (* Alignment of image rows (4 or 8). *) - width: Integer; (* Image width in pixels. *) - height: Integer; (* Image height in pixels. *) - roi: pIplROI; (* Image ROI. If NULL, the whole image is selected. *) - maskROI: pIplImage; (* Must be NULL. *) - imageId: Pointer; (* " " *) - tileInfo: pIplTileInfo; (* " " *) - imageSize: Integer; (* Image data size in bytes *) - imageData: PByte; (* Pointer to aligned image data. *) - widthStep: Integer; (* Size of aligned image row in bytes. *) - BorderMode: array [0 .. 3] of Integer; (* Ignored by ocv. *) + colorModel: TA4CVChar; (* Ignored by OpenCV *) + channelSeq: TA4CVChar; (* ditto *) + dataOrder: Integer; (* 0 - interleaved color channels, 1 - separate color channels. *) + origin: Integer; (* 0 - top-left origin, *) + align: Integer; (* Alignment of image rows (4 or 8). *) + width: Integer; (* Image width in pixels. *) + height: Integer; (* Image height in pixels. *) + roi: pIplROI; (* Image ROI. If NULL, the whole image is selected. *) + maskROI: pIplImage; (* Must be NULL. *) + imageId: Pointer; (* " " *) + tileInfo: pIplTileInfo; (* " " *) + imageSize: Integer; (* Image data size in bytes *) + imageData: PByte; (* Pointer to aligned image data. *) + widthStep: Integer; (* Size of aligned image row in bytes. *) + BorderMode: array [0 .. 3] of Integer; (* Ignored by ocv. *) BorderConst: array [0 .. 3] of Integer; (* Ditto. *) - imageDataOrigin: PByte; (* Pointer to very origin of image data *) + imageDataOrigin: PByte; (* Pointer to very origin of image data *) end; TcvImage = TIplImage; @@ -419,8 +424,9 @@ const {$EXTERNALSYM IPL_IMAGE_MAGIC_VAL} CV_TYPE_NAME_IMAGE = 'opencv-image'; - (* *************************************************************************************** - * Matrix cType (CvMat) *************************************************************************************** *) + // * *************************************************************************************** + // * Matrix cType (CvMat) + // *************************************************************************************** const CV_CN_MAX = 512; @@ -709,7 +715,7 @@ type thresh: array [0 .. CV_MAX_DIM - 1, 0 .. 1] of Single; (* For uniform histograms. *) thresh2: pSingle; (* For non-uniform histograms. *) - mat: TCvMatND; (* Embedded matrix header for array histograms. *) + mat: TCvMatND; (* Embedded matrix header for array histograms. *) end; (* ***************************************************************************************\ @@ -774,7 +780,7 @@ type TcvPoint2f = TCvPoint2D32f; pcvPoint2f = pCvPoint2D32f; - TArrayOfcvPoint2f = TArray<TcvPoint2f>; + TArrayOfcvPoint2f = array of TcvPoint2f; // TArray<TcvPoint2f>; pCvPoint3D32f = ^TCvPoint3D32f; @@ -830,8 +836,8 @@ Type TCvBox2D = record center: TCvPoint2D32f; (* Center of the box. *) - size: TCvSize2D32f; (* Box width and length. *) - angle: Single; (* Angle between the horizontal axis *) + size: TCvSize2D32f; (* Box width and length. *) + angle: Single; (* Angle between the horizontal axis *) end; (* Line iterator state: *) @@ -864,16 +870,18 @@ const type pCvScalar = ^TCvScalar; + { TCvScalar } + TCvScalar = record val: array [0 .. 3] of Double; - class operator LessThan(a, b: TCvScalar): Boolean; - class operator GreaterThan(a, b: TCvScalar): Boolean; + class operator {$IFDEF FPC}<{$ELSE}LessThan{$ENDIF}(a, b: TCvScalar): Boolean; + class operator {$IFDEF FPC}>{$ELSE}GreaterThan{$ENDIF}(a, b: TCvScalar): Boolean; end; - (* ************************************************************************************** *) - (* Dynamic Data structures *) - (* ************************************************************************************** *) - (* ******************************* Memory storage *************************************** *) +(* ************************************************************************************** *) +(* Dynamic Data structures *) +(* ************************************************************************************** *) +(* ******************************* Memory storage *************************************** *) type pCvMemBlock = ^TCvMemBlock; @@ -895,11 +903,10 @@ type top: pCvMemBlock; (* First allocated block. *) parent: pCvMemStorage; (* Current memory block - top of the stack. *) (* We get new blocks from parent as needed. *) - block_size: Integer; (* Block size. *) - free_space: Integer; (* Remaining free space in current block. *) + block_size: Integer; (* Block size. *) + free_space: Integer; (* Remaining free space in current block. *) end; -type pCvMemStoragePos = ^TCvMemStoragePos; TCvMemStoragePos = record @@ -912,58 +919,64 @@ type pCvSeqBlock = ^TCvSeqBlock; TCvSeqBlock = record - prev: pCvSeqBlock; (* Previous sequence block. *) - next: pCvSeqBlock; (* Next sequence block. *) + prev: pCvSeqBlock; (* Previous sequence block. *) + next: pCvSeqBlock; (* Next sequence block. *) start_index: Integer; (* Index of the first element in the block + *) - count: Integer; (* Number of elements in the block. *) - data: Pointer; (* Pointer to the first element of the block. *) + count: Integer; (* Number of elements in the block. *) + data: Pointer; (* Pointer to the first element of the block. *) end; TCvSeqBlockArray = array [0 .. 0] of TCvSeqBlock; pCvSeqBlockArray = ^TCvSeqBlockArray; +{$IFDEF FPC}generic{$ENDIF} TCV_TREE_NODE_FIELDS<node_type> = record - flags: Integer; (* Miscellaneous flags. *) - header_size: Integer; (* Size of sequence header. *) - h_prev: ^node_type; (* Previous sequence. *) - h_next: ^node_type; (* Next sequence. *) - v_prev: ^node_type; (* 2nd previous sequence. *) - v_next: ^node_type; (* 2nd next sequence. *) +{$IFDEF FPC} + type pnode_type = ^node_type; +public +{$ENDIF} + flags: Integer; (* Miscellaneous flags. *) + header_size: Integer; (* Size of sequence header. *) + h_prev: {$IFDEF FPC}pnode_type{$ELSE}^node_type{$ENDIF}; (* Previous sequence. *) + h_next: {$IFDEF FPC}pnode_type{$ELSE}^node_type{$ENDIF}; (* Next sequence. *) + v_prev: {$IFDEF FPC}pnode_type{$ELSE}^node_type{$ENDIF}; (* 2nd previous sequence. *) + v_next: {$IFDEF FPC}pnode_type{$ELSE}^node_type{$ENDIF}; (* 2nd next sequence. *) end; pCvSeq = ^TCvSeq; - TCvSeq = record - flags: Integer; (* Miscellaneous flags. *) - header_size: Integer; (* Size of sequence header. *) - h_prev: pCvSeq; (* Previous sequence. *) - h_next: pCvSeq; (* Next sequence. *) - v_prev: pCvSeq; (* 2nd previous sequence. *) - v_next: pCvSeq; (* 2nd next sequence. *) - total: Integer; (* Total number of elements. *) - elem_size: Integer; (* Size of sequence element in bytes. *) - block_max: Pointer; (* Maximal bound of the last block. *) - ptr: pschar; (* Current write pointer. *) - delta_elems: Integer; (* Grow seq this many at a time. *) - storage: pCvMemStorage; (* Where the seq is stored. *) - free_blocks: pCvSeqBlock; (* Free blocks list. *) - first: pCvSeqBlock; (* Pointer to the first sequence block. *) + TCvSeq = record flags: Integer; (* Miscellaneous flags. *) + header_size: Integer; (* Size of sequence header. *) + h_prev: pCvSeq; (* Previous sequence. *) + h_next: pCvSeq; (* Next sequence. *) + v_prev: pCvSeq; (* 2nd previous sequence. *) + v_next: pCvSeq; (* 2nd next sequence. *) + total: Integer; (* Total number of elements. *) + elem_size: Integer; (* Size of sequence element in bytes. *) + block_max: Pointer; (* Maximal bound of the last block. *) + ptr: pschar; (* Current write pointer. *) + delta_elems: Integer; (* Grow seq this many at a time. *) + storage: pCvMemStorage; (* Where the seq is stored. *) + free_blocks: pCvSeqBlock; (* Free blocks list. *) + first: pCvSeqBlock; (* Pointer to the first sequence block. *) end; + TCV_TREE_NODE_FIELDS_TCvSeq = {$IFDEF FPC} specialize {$ENDIF} TCV_TREE_NODE_FIELDS<TCvSeq>; + (* Read/Write sequence. Elements can be dynamically inserted to or deleted from the sequence. *) - TCV_SEQUENCE_FIELDS = record - CV_TREE_NODE_FIELDS: TCV_TREE_NODE_FIELDS<TCvSeq>; - total: Integer; (* Total number of elements. *) - elem_size: Integer; (* Size of sequence element in bytes. *) - block_max: pschar; (* Maximal bound of the last block. *) - ptr: pschar; (* Current write pointer. *) - delta_elems: Integer; (* Grow seq this many at a time. *) - storage: pCvMemStorage; (* Where the seq is stored. *) - free_blocks: pCvSeqBlock; (* Free blocks list. *) - first: pCvSeqBlock; (* Pointer to the first sequence block. *) + TCV_SEQUENCE_FIELDS = record // + CV_TREE_NODE_FIELDS: TCV_TREE_NODE_FIELDS_TCvSeq; + total: Integer; (* Total number of elements. *) + elem_size: Integer; (* Size of sequence element in bytes. *) + block_max: pschar; (* Maximal bound of the last block. *) + ptr: pschar; (* Current write pointer. *) + delta_elems: Integer; (* Grow seq this many at a time. *) + storage: pCvMemStorage; (* Where the seq is stored. *) + free_blocks: pCvSeqBlock; (* Free blocks list. *) + first: pCvSeqBlock; (* Pointer to the first sequence block. *) end; pCvSeqArray = array [0 .. 1] of pCvSeq; @@ -982,20 +995,20 @@ type pCvContour = ^TCvContour; TCvContour = record - flags: Integer; // micsellaneous flags - header_size: Integer; // size of sequence header - h_prev: pCvArr; // previous sequence - h_next: pCvArr; // next sequence - v_prev: pCvArr; // 2nd previous sequence - v_next: pCvArr; // 2nd next sequence - total: Integer; // total number of elements - elem_size: Integer; // size of sequence element in bytes - block_max: pAnsiChar; // maximal bound of the last block - ptr: pAnsiChar; // current write pointer - delta_elems: Integer; // how many elements allocated when the seq grows - storage: pCvMemStorage; // where the seq is stored + flags: Integer; // micsellaneous flags + header_size: Integer; // size of sequence header + h_prev: pCvArr; // previous sequence + h_next: pCvArr; // next sequence + v_prev: pCvArr; // 2nd previous sequence + v_next: pCvArr; // 2nd next sequence + total: Integer; // total number of elements + elem_size: Integer; // size of sequence element in bytes + block_max: pAnsiChar; // maximal bound of the last block + ptr: pAnsiChar; // current write pointer + delta_elems: Integer; // how many elements allocated when the seq grows + storage: pCvMemStorage; // where the seq is stored free_blocks: pCvSeqBlock; // free blocks list - first: pCvSeqBlock; // pointer to the first sequence block + first: pCvSeqBlock; // pointer to the first sequence block rect: TCvRect; color: Integer; reserved: array [0 .. 2] of Integer; @@ -1009,9 +1022,14 @@ type The MSB(most-significant or sign bit) of the first field (flags) is 0 iff the element exists. *) type + {$IFDEF FPC}generic{$ENDIF} TCV_SET_ELEM_FIELDS<elem_type> = record + {$IFDEF FPC} + type pelem_type = ^elem_type; + public + {$ENDIF} flags: Integer; - next_free: ^elem_type; + next_free: {$IFDEF FPC}pelem_type{$ELSE}^elem_type{$ENDIF}; end; pCvSetElem = ^TCvSetElem; @@ -1033,20 +1051,20 @@ type pCvSet = ^TCvSet; TCvSet = record - flags: Integer; (* Miscellaneous flags. *) - header_size: Integer; (* Size of sequence header. *) - h_prev: pCvSeq; (* Previous sequence. *) - h_next: pCvSeq; (* Next sequence. *) - v_prev: pCvSeq; (* 2nd previous sequence. *) - v_next: pCvSeq; (* 2nd next sequence. *) - total: Integer; (* Total number of elements. *) - elem_size: Integer; (* Size of sequence element in bytes. *) - block_max: Pointer; (* Maximal bound of the last block. *) - ptr: Pointer; (* Current write pointer. *) - delta_elems: Integer; (* Grow seq this many at a time. *) - storage: pCvMemStorage; (* Where the seq is stored. *) + flags: Integer; (* Miscellaneous flags. *) + header_size: Integer; (* Size of sequence header. *) + h_prev: pCvSeq; (* Previous sequence. *) + h_next: pCvSeq; (* Next sequence. *) + v_prev: pCvSeq; (* 2nd previous sequence. *) + v_next: pCvSeq; (* 2nd next sequence. *) + total: Integer; (* Total number of elements. *) + elem_size: Integer; (* Size of sequence element in bytes. *) + block_max: Pointer; (* Maximal bound of the last block. *) + ptr: Pointer; (* Current write pointer. *) + delta_elems: Integer; (* Grow seq this many at a time. *) + storage: pCvMemStorage; (* Where the seq is stored. *) free_blocks: pCvSeqBlock; (* Free blocks list. *) - first: pCvSeqBlock; (* Pointer to the first sequence block. *) + first: pCvSeqBlock; (* Pointer to the first sequence block. *) free_elems: pCvSetElem; active_count: Integer; end; @@ -1413,9 +1431,9 @@ type TCvSeqWriter = record header_size: Integer; - Seq: pCvSeq; // * the sequence written */ + Seq: pCvSeq; // * the sequence written */ block: pCvSeqBlock; // * current block */ - ptr: Pointer; // * pointer to free space */ + ptr: Pointer; // * pointer to free space */ block_min: Pointer; // * pointer to the beginning of block*/ block_max: Pointer; // * pointer to the end of block */ end; @@ -1424,13 +1442,13 @@ type TCvSeqReader = record header_size: Integer; - Seq: pCvSeq; // * sequence, beign read */ - block: pCvSeqBlock; // * current block */ - ptr: Pointer; // * pointer to element be read next */ - block_min: Pointer; // * pointer to the beginning of block */ - block_max: Pointer; // * pointer to the end of block */ + Seq: pCvSeq; // * sequence, beign read */ + block: pCvSeqBlock; // * current block */ + ptr: Pointer; // * pointer to element be read next */ + block_min: Pointer; // * pointer to the beginning of block */ + block_max: Pointer; // * pointer to the end of block */ delta_index: Integer; // * = seq->first->start_index */ - prev_elem: Pointer; // * pointer to previous element */ + prev_elem: Pointer; // * pointer to previous element */ end; { **************************************************************************************** @@ -1467,7 +1485,7 @@ function CV_GET_SEQ_ELEM(const size_of_elem: Integer; Seq: pCvSeq; index: Intege // Assert((writer).ptr <= (writer).block_max - SizeOf(elem)); // memcpy((writer).ptr, and (elem), SizeOf(elem)); (writer).ptr := mod +SizeOf(elem) then; end; -function CV_CAST_8U(t: Integer): uchar; {$IFDEF USE_INLINE}inline; {$ENDIF} +function CV_CAST_8U(T: Integer): uchar; {$IFDEF USE_INLINE}inline; {$ENDIF} (* /* Move reader position forward: */ #define CV_NEXT_SEQ_ELEM( elem_size, reader ) \ @@ -1644,8 +1662,7 @@ Type // typedef void* (CV_CDECL *CvReadFunc)( CvFileStorage* storage, CvFileNode* node ); TCvReadFunc = function(storage: pCvFileStorage; node: pCvFileNode): Pointer; cdecl; // typedef void (CV_CDECL *CvWriteFunc)( CvFileStorage* storage, const char* name,const void* struct_ptr, CvAttrList attributes ); - TCvWriteFunc = procedure(storage: pCvFileStorage; const name: pCVChar; const struct_ptr: pPointer; - attributes: TCvAttrList); cdecl; + TCvWriteFunc = procedure(storage: pCvFileStorage; const name: pCVChar; const struct_ptr: pPointer; attributes: TCvAttrList); cdecl; // typedef void* (CV_CDECL *CvCloneFunc)( const void* struct_ptr ); TCvCloneFunc = function(const struct_ptr: pPointer): Pointer; cdecl; @@ -1834,12 +1851,12 @@ Type end; // #define CV_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t)) -procedure CV_SWAP(var a, b, t: pIplImage); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; +procedure CV_SWAP(var a, b, T: pIplImage); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; procedure CV_SWAP(var a, b: pIplImage); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; -procedure CV_SWAP(var a, b, t: pCvPoint2D32f); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; +procedure CV_SWAP(var a, b, T: pCvPoint2D32f); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; procedure CV_SWAP(var a, b: pCvPoint2D32f); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; -procedure CV_SWAP(var a, b, t: pCvMat); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; -procedure CV_SWAP(var a, b, t: Pointer); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; +procedure CV_SWAP(var a, b, T: pCvMat); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; +procedure CV_SWAP(var a, b, T: Pointer); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; procedure CV_SWAP(var a, b: Pointer); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; // {$IFNDEF MIN} @@ -2282,8 +2299,7 @@ function cvScalarAll(val0123: Double): TCvScalar; {$IFDEF USE_INLINE}inline; {$E function cvPoint(const x: Integer = 0; const y: Integer = 0): TCvPoint; {$IFDEF USE_INLINE}inline; {$ENDIF} function CvPoint2f(const x: Single = 0; const y: Single = 0): TcvPoint2f; {$IFDEF USE_INLINE}inline; {$ENDIF} function CvSize(const width, height: Integer): TCvSize; {$IFDEF USE_INLINE}inline; {$ENDIF} -function CvScalar(const val0: Double; const val1: Double = 0; const val2: Double = 0; const val3: Double = 0) - : TCvScalar; +function CvScalar(const val0: Double; const val1: Double = 0; const val2: Double = 0; const val3: Double = 0): TCvScalar; {$IFDEF USE_INLINE}inline; {$ENDIF} function cvRandInt(Var rng: TCvRNG): Cardinal; {$IFDEF USE_INLINE}inline; {$ENDIF} function CvRect(Const x, y, width, height: Integer): TCvRect; {$IFDEF USE_INLINE}inline; {$ENDIF} @@ -2297,26 +2313,29 @@ const * (Use together with cvCreateData, or use cvCreateMat instead to * get a matrix with allocated data): * - CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL)) - { - CvMat m; - assert( (unsigned)CV_MAT_DEPTH(type) <= CV_64F ); - type = CV_MAT_TYPE(type); - m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type; - m.cols = cols; - m.rows = rows; - m.step = m.cols*CV_ELEM_SIZE(type); - m.data.ptr = (uchar*)data; - m.refcount = NULL; - m.hdr_refcount = 0; - - return m; } +// CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL)) +// { +// CvMat m; +// assert( (unsigned)CV_MAT_DEPTH(type) <= CV_64F ); +// type = CV_MAT_TYPE(type); +// m.type = CV_MAT_MAGIC_VAL | CV_MAT_CONT_FLAG | type; +// m.cols = cols; +// m.rows = rows; +// m.step = m.cols*CV_ELEM_SIZE(type); +// m.data.ptr = (uchar*)data; +// m.refcount = NULL; +// m.hdr_refcount = 0; +// +// return m; +// } + function cvMat(const rows, cols: Integer; etype: Integer; data: Pointer = nil): TCvMat; function CV_MAT_DEPTH(const flags: Integer): Integer; function CV_MAT_TYPE(const flags: Integer): Integer; -(* Size of each channel item, +(* +Size of each channel item, 0x124489 = 1000 0100 0100 0010 0010 0001 0001 ~ array of sizeof(arr_type_elem) */ #define CV_ELEM_SIZE1(type) \ @@ -2328,10 +2347,9 @@ function CV_MAT_CN(const flags: Integer): Integer; function CV_32FC1: Integer; {$IFDEF USE_INLINE}inline; {$ENDIF} function CV_32SC1: Integer; {$IFDEF USE_INLINE}inline; {$ENDIF} function CV_MAKETYPE(depth, cn: Integer): Integer; {$IFDEF USE_INLINE}inline; {$ENDIF} -(* - #define CV_MAT_ELEM( mat, elemtype, row, col ) - (*(elemtype* )CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype))) -*) + +// #define CV_MAT_ELEM( mat, elemtype, row, col ) +// (*(elemtype* )CV_MAT_ELEM_PTR_FAST( mat, row, col, sizeof(elemtype))) function CV_MAT_ELEM(const mat: TCvMat; const elemsize: Integer; const row, col: Integer): Pointer; {$IFDEF USE_INLINE}inline; {$ENDIF} (* @@ -2358,8 +2376,8 @@ uses System.SysUtils, System.AnsiStrings {$ELSE} - SysUtils, - AnsiStrings + SysUtils +// ,AnsiStrings {$ENDIF} ; @@ -2421,25 +2439,24 @@ begin Result.next := next; end; -function CV_MAT_DEPTH; +function CV_MAT_DEPTH(const flags: Integer): Integer; begin Result := flags and CV_MAT_DEPTH_MASK; end; -function CV_MAT_TYPE; +function CV_MAT_TYPE(const flags: Integer): Integer; begin Result := flags and CV_MAT_TYPE_MASK; end; -function CV_MAT_CN; +function CV_MAT_CN(const flags: Integer): Integer; begin Result := ((((flags) and CV_MAT_CN_MASK) shr CV_CN_SHIFT) + 1); end; -function CV_ELEM_SIZE; +function CV_ELEM_SIZE(const _type: Integer): Integer; begin - Result := (CV_MAT_CN(_type) shl ((((SizeOf(NativeInt) div 4 + 1) * (16384 or $3A50)) shr CV_MAT_DEPTH(_type) * - 2) and 3)); + Result := (CV_MAT_CN(_type) shl ((((SizeOf(NativeInt) div 4 + 1) * (16384 or $3A50)) shr CV_MAT_DEPTH(_type) * 2) and 3)); end; function CV_32SC1: Integer; @@ -2457,7 +2474,7 @@ begin Result := (CV_MAT_DEPTH(depth) + (((cn) - 1) shl CV_CN_SHIFT)); end; -function cvMat; +function cvMat(const rows, cols: Integer; etype: Integer; data: Pointer = nil): TCvMat; begin if not(CV_MAT_DEPTH(etype) <= CV_64F) then exit; @@ -2471,7 +2488,7 @@ begin Result.hdr_refcount := 0; end; -function cvScalarAll; +function cvScalarAll(val0123: Double): TCvScalar; {$IFDEF USE_INLINE}inline; {$ENDIF} begin Result.val[0] := val0123; Result.val[1] := val0123; @@ -2479,19 +2496,20 @@ begin Result.val[3] := val0123; end; -function cvPoint; +function cvPoint(const x: Integer = 0; const y: Integer = 0): TCvPoint; {$IFDEF USE_INLINE}inline; {$ENDIF} begin Result.x := x; Result.y := y; end; -function CvPoint2f; +function CvPoint2f(const x: Single = 0; const y: Single = 0): TcvPoint2f; {$IFDEF USE_INLINE}inline; {$ENDIF} begin Result.x := x; Result.y := y; end; -function CvScalar; +function CvScalar(const val0: Double; const val1: Double = 0; const val2: Double = 0; const val3: Double = 0): TCvScalar; +{$IFDEF USE_INLINE}inline; {$ENDIF} begin Result.val[0] := val0; Result.val[1] := val1; @@ -2499,13 +2517,13 @@ begin Result.val[3] := val3; end; -function CvSize; +function CvSize(const width, height: Integer): TCvSize; {$IFDEF USE_INLINE}inline; {$ENDIF} begin Result.width := width; Result.height := height; end; -function CvRect; +function CvRect(Const x, y, width, height: Integer): TCvRect; {$IFDEF USE_INLINE}inline; {$ENDIF} begin Result.x := x; Result.y := y; @@ -2513,7 +2531,7 @@ begin Result.height := height; end; -function cvRandInt; +function cvRandInt(Var rng: TCvRNG): Cardinal; {$IFDEF USE_INLINE}inline; {$ENDIF} begin {$Q-} rng := TCvRNG(rng * CV_RNG_COEFF + (rng shr 32)); @@ -2521,7 +2539,7 @@ begin Result := Cardinal(rng); end; -function cvRound; +function cvRound(Value: Double): Integer; begin Result := Round(Value); end; @@ -2544,19 +2562,19 @@ begin Result := ifFalse; end; -function CV_NODE_TYPE; +function CV_NODE_TYPE(const flags: Integer): Integer; {$IFDEF USE_INLINE}inline; {$ENDIF} begin // CV_NODE_TYPE(flags)((flags) and CV_NODE_TYPE_MASK); Result := flags and CV_NODE_TYPE_MASK; end; -function CV_NODE_IS_INT; +function CV_NODE_IS_INT(const flags: Integer): Boolean; {$IFDEF USE_INLINE}inline; {$ENDIF} begin // CV_NODE_IS_INT(flags) (CV_NODE_TYPE(flags) == CV_NODE_INT) Result := CV_NODE_TYPE(flags) = CV_NODE_INT; end; -function CV_NODE_IS_REAL; +function CV_NODE_IS_REAL(const flags: Integer): Boolean; {$IFDEF USE_INLINE}inline; {$ENDIF} begin // CV_NODE_IS_REAL(flags) (CV_NODE_TYPE(flags) == CV_NODE_REAL) Result := CV_NODE_TYPE(flags) = CV_NODE_REAL; @@ -2590,7 +2608,7 @@ begin cvChangeSeqBlock(@Reader, 1); end; -function cvFloor; +function cvFloor(Value: Double): Integer; {$IFDEF USE_INLINE}inline; {$ENDIF} Var diff: TCv32suf; i: Integer; @@ -2602,25 +2620,25 @@ begin Result := i; end; -function cvPointFrom32f; +function cvPointFrom32f(point: TCvPoint2D32f): TCvPoint; {$IFDEF USE_INLINE}inline; {$ENDIF} begin Result.x := cvRound(point.x); Result.y := cvRound(point.y); end; -function CvTermCriteria; +function CvTermCriteria(_type: Integer; max_iter: Integer; epsilon: Double): TCvTermCriteria; {$IFDEF USE_INLINE}inline;{$ENDIF} begin Result.cType := _type; Result.max_iter := max_iter; Result.epsilon := epsilon; end; -function cvPointTo32f; +function cvPointTo32f(point: TCvPoint): TCvPoint2D32f; {$IFDEF USE_INLINE}inline; {$ENDIF} begin Result := CvPoint2D32f(point.x, point.y); end; -function CvPoint2D32f; +function CvPoint2D32f(x, y: Single): TCvPoint2D32f; {$IFDEF USE_INLINE}inline; {$ENDIF} begin Result.x := x; Result.y := y; @@ -2633,28 +2651,28 @@ begin Result.z := z; end; -procedure CV_SWAP(var a, b, t: Pointer); +procedure CV_SWAP(var a, b, T: Pointer); begin - t := a; + T := a; a := b; - b := t; + b := T; end; procedure CV_SWAP(var a, b: Pointer); Var - t: Pointer; + T: Pointer; begin - CV_SWAP(a, b, t); + CV_SWAP(a, b, T); end; -procedure CV_SWAP(var a, b, t: pCvMat); +procedure CV_SWAP(var a, b, T: pCvMat); begin - CV_SWAP(Pointer(a), Pointer(b), Pointer(t)); + CV_SWAP(Pointer(a), Pointer(b), Pointer(T)); end; -procedure CV_SWAP(var a, b, t: pIplImage); +procedure CV_SWAP(var a, b, T: pIplImage); begin - CV_SWAP(Pointer(a), Pointer(b), Pointer(t)); + CV_SWAP(Pointer(a), Pointer(b), Pointer(T)); end; procedure CV_SWAP(var a, b: pIplImage); @@ -2662,9 +2680,9 @@ begin CV_SWAP(Pointer(a), Pointer(b)); end; -procedure CV_SWAP(var a, b, t: pCvPoint2D32f); +procedure CV_SWAP(var a, b, T: pCvPoint2D32f); begin - CV_SWAP(Pointer(a), Pointer(b), Pointer(t)); + CV_SWAP(Pointer(a), Pointer(b), Pointer(T)); end; procedure CV_SWAP(var a, b: pCvPoint2D32f); @@ -2672,16 +2690,16 @@ begin CV_SWAP(Pointer(a), Pointer(b)); end; -function CV_32SC2; +function CV_32SC2: Integer; {$IFDEF USE_INLINE}inline; {$ENDIF} begin Result := CV_MAKETYPE(CV_32S, 2); end; -function CV_CAST_8U(t: Integer): uchar; +function CV_CAST_8U(T: Integer): uchar; begin - if (not(t and (not 255)) <> 0) then - Result := t - else if t > 0 then + if (not(T and (not 255)) <> 0) then + Result := T + else if T > 0 then Result := 255 else Result := 0; @@ -2689,14 +2707,14 @@ end; {$IFDEF DELPHIXE_UP} -function CV_GET_SEQ_ELEM; +function CV_GET_SEQ_ELEM(const size_of_elem: Integer; Seq: pCvSeq; index: Integer): Pointer; {$IFDEF USE_INLINE}inline; +{$ENDIF} 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 USE_INLINE}inline; -{$ENDIF} +function CV_SEQ_ELEM(Seq: pCvSeq; const size_of_elem: Integer; index: Integer): Pointer; {$IFDEF USE_INLINE}inline; {$ENDIF} begin // assert(sizeof((seq)->first[0]) == sizeof(CvSeqBlock) && (seq)->elem_size == sizeof(elem_type)) Assert(Assigned(Seq^.first) and (SizeOf(Seq^.first[0]) = SizeOf(TCvSeqBlock)) and (Seq^.elem_size = size_of_elem)); @@ -2759,8 +2777,21 @@ end; function CV_IMAGE_ELEM(image: pIplImage; size_elemtype, row, col: Integer): Pointer; {$IFDEF USE_INLINE}inline; {$ENDIF} begin // (((elemtype*)((image)->imageData + (image)->widthStep*(row)))[(col)]) - Result := {$IFDEF DELPHI7}Pointer({$ENDIF DELPHI7}{$IFDEF DELPHI2005_UP}PByte{$ELSE}Integer{$ENDIF}(image^.imageData) - + image^.widthStep * row + col * size_elemtype{$IFDEF DELPHI7}){$ENDIF DELPHI7}; + Result := + Pointer(Integer(image^.imageData) + image^.widthStep * row + col * size_elemtype); +// {$IFDEF DELPHI7} +// Pointer( +// ({$ENDIF DELPHI7} // +// {$IFDEF DELPHI2005_UP} // +// PByte // +// {$ELSE} // +// Integer // +// {$ENDIF} +// (image^.imageData) + image^.widthStep * row + // +// col * size_elemtype // +// {$IFDEF DELPHI7} +// ) // +// {$ENDIF DELPHI7}; end; function cvRealScalar(val0: Double): TCvScalar; {$IFDEF USE_INLINE}inline; {$ENDIF} @@ -2847,15 +2878,17 @@ end; {$ENDIF} { TCvScalar } -class operator TCvScalar.GreaterThan(a, b: TCvScalar): Boolean; + +class operator TCvScalar.{$IFDEF FPC}<{$ELSE}LessThan{$ENDIF}(a, b: TCvScalar): Boolean; +begin + Result := (a.val[0] < b.val[0]) and (a.val[1] < b.val[1]) and (a.val[2] < b.val[2]) and (a.val[3] <= b.val[3]); +end; + +class operator TCvScalar.{$IFDEF FPC}>{$ELSE}GreaterThan{$ENDIF}(a, b: TCvScalar): Boolean; begin Result := (a.val[0] > b.val[0]) and (a.val[1] > b.val[1]) and (a.val[2] > b.val[2]) and (a.val[3] >= b.val[3]); end; -class operator TCvScalar.LessThan(a, b: TCvScalar): Boolean; -begin - Result := (a.val[0] < b.val[0]) and (a.val[1] < b.val[1]) and (a.val[2] < b.val[2]) and (a.val[3] <= b.val[3]); -end; { TCvMat } @@ -2930,7 +2963,7 @@ function CV_IS_MATND(const mat: Pointer): Boolean; inline; begin // #define CV_IS_MATND(mat) \ // (CV_IS_MATND_HDR(mat) && ((const CvMatND*)(mat))->data.ptr != NULL) - Result := CV_IS_MATND_HDR(mat) and Assigned(pCvMatND(mat).data.ptr); + Result := CV_IS_MATND_HDR(mat) and Assigned(pCvMatND(mat)^.data.ptr); end; function CV_IS_MAT(const mat: Pointer): Boolean; inline; diff --git a/source/ocv.core_c.pas b/source/ocv.core_c.pas index f53cba1..fd1e6bc 100644 --- a/source/ocv.core_c.pas +++ b/source/ocv.core_c.pas @@ -53,16 +53,14 @@ unit ocv.core_c; interface uses - // {$IFDEF MSWINDOWS} - // WinApi.Windows, - // {$ENDIF ~MSWINDOWS} ocv.core.types_c; { **************************************************************************************** * cArray allocation, deallocation, initialization and access to elements * **************************************************************************************** } -{ <malloc> wrapper. +{ + <malloc> wrapper. If there is no enough memory, the cFunction (as well as other OpenCV functions that call cvAlloc) raises an error. @@ -70,7 +68,8 @@ uses {$EXTERNALSYM cvAlloc} function cvAlloc(size: NativeUInt): Pointer; cdecl; -{ <free> wrapper. +{ + <free> wrapper. Here and further all the memory releasing functions (that all call cvFree) take Double cPointer in order to to clear cPointer to the data after releasing it. @@ -80,13 +79,15 @@ function cvAlloc(size: NativeUInt): Pointer; cdecl; procedure cvFree_(ptr: Pointer); cdecl; {$EXTERNALSYM cvFree} procedure cvFree(var ptr); {$IFDEF USE_INLINE} inline; {$ENDIF} -{ Allocates and initializes IplImage header +{ + Allocates and initializes IplImage header CVAPI(IplImage*) cvCreateImageHeader( CvSize size, int depth, int channels ); } {$EXTERNALSYM cvCreateImageHeader} function cvCreateImageHeader(size: TCvSize; depth: Integer; channels: Integer): pIplImage; cdecl; -{ Inializes IplImage header +{ + Inializes IplImage header CVAPI(IplImage*) cvInitImageHeader( IplImage* image, CvSize size, int depth, int channels, int origin CV_DEFAULT(0), int align CV_DEFAULT(4)); @@ -94,38 +95,44 @@ function cvCreateImageHeader(size: TCvSize; depth: Integer; channels: Integer): {$EXTERNALSYM cvInitImageHeader} function cvInitImageHeader(image: pIplImage; size: TCvSize; depth: Integer; channels: Integer; origin: Integer = 0; align: Integer = 4): pIplImage; cdecl; -{ Creates IPL image (header and data +{ + Creates IPL image (header and data CVAPI(IplImage*) cvCreateImage( CvSize size, int depth, int channels ); } {$EXTERNALSYM cvCreateImage} function cvCreateImage(size: TCvSize; depth, channels: Integer): pIplImage; cdecl; -{ Releases (i.e. deallocates) IPL image header +{ + Releases (i.e. deallocates) IPL image header CVAPI(void) cvReleaseImageHeader( IplImage** image ); } {$EXTERNALSYM cvReleaseImageHeader} procedure cvReleaseImageHeader(var image: pIplImage); cdecl; -{ Releases IPL image header and data +{ + Releases IPL image header and data CVAPI(void) cvReleaseImage( IplImage** image ); } {$EXTERNALSYM cvReleaseImage} procedure cvReleaseImage(var image: pIplImage); cdecl; -{ Creates a copy of IPL image (widthStep may differ) +{ + Creates a copy of IPL image (widthStep may differ) CVAPI(IplImage*) cvCloneImage( const IplImage* image ); } {$EXTERNALSYM cvCloneImage} function cvCloneImage(const image: pIplImage): pIplImage; cdecl; -{ Sets a Channel Of Interest (only a few functions support COI) - +{ + Sets a Channel Of Interest (only a few functions support COI) - use cvCopy to extract the selected channel and/or put it back CVAPI(void) cvSetImageCOI( IplImage* image, int coi ); } {$EXTERNALSYM cvSetImageCOI} procedure cvSetImageCOI(image: pIplImage; coi: Integer); cdecl; -{ Retrieves image Channel Of Interest +{ + Retrieves image Channel Of Interest CVAPI(int) cvGetImageCOI( const IplImage* image ); } {$EXTERNALSYM cvGetImageCOI} @@ -199,7 +206,7 @@ procedure cvReleaseMat(var mat: pCvMat); cdecl; // mat->refcount = NULL; // } // } -procedure cvDecRefData(arr: pCvArr); inline; +procedure cvDecRefData(arr: pCvArr); {$IFDEF USE_INLINE}inline;{$ENDIF} // Increments CvMat data reference counter // CV_INLINE int cvIncRefData( pCvArr* arr ) @@ -235,6 +242,7 @@ function cvCloneMat(const mat: pCvMat): pCvMat; cdecl; } {$EXTERNALSYM cvGetSubRect} function cvGetSubRect(arr: pCvArr; submat: pCvArr; rect: TCvRect): pCvMat; cdecl; +function cvGetSubArr(arr: pCvArr; submat: pCvArr; rect: TCvRect): pCvMat; cdecl; { Selects row span of the input array: arr(start_row:delta_row:end_row,:) (end_row is not included into the span). @@ -789,10 +797,42 @@ procedure cvAnd(const src1: pCvArr; const src2: pCvArr; dst: pCvArr; masl: pCvAr procedure cvAndS(const src: pCvArr; value: TCvScalar; dst: pCvArr; const mask: pCvArr = nil); cdecl; +//void cvOrS(const CvArr* src, CvScalar value, CvArr* dst, const CvArr* mask=NULL) +procedure cvOrS(const src: pCvArr; value: TCvScalar; dst: pCvArr; const mask: pCvArr = nil); cdecl; + +//void cvCmp(const CvArr* src1, const CvArr* src2, CvArr* dst, int cmp_op) +procedure cvCmp(const src1, src2: pCvArr; dst: pCvArr; cmp_op: integer); cdecl; + +//void cvCmpS(const CvArr* src, double value, CvArr* dst, int cmp_op) +procedure cvCmpS(const src: pCvArr; value: double; dst: pCvArr; cmp_op: integer); cdecl; + +//void cvMin(const CvArr* src1, const CvArr* src2, CvArr* dst) +procedure cvMin(const src1, src2:pCvArr; dst:pCvArr); cdecl; + +//void cvMinS(const CvArr* src, double value, CvArr* dst) +procedure cvMinS(const src:pCvArr; value:double; dst:pCvArr); cdecl; + + +//void cvMax(const CvArr* src1, const CvArr* src2, CvArr* dst) +procedure cvMax(const src1, src2:pCvArr; dst:pCvArr); cdecl; + +//void cvMaxS(const CvArr* src, double value, CvArr* dst) +procedure cvMaxS(const src:pCvArr; value:double; dst:pCvArr); cdecl; + // dst(x,y,c) = abs(src1(x,y,c) - src2(x,y,c)) // CVAPI(void) cvAbsDiff( const pCvArr* src1, const pCvArr* src2, pCvArr* dst ); procedure cvAbsDiff(const src1: pCvArr; const src2: pCvArr; dst: pCvArr); cdecl; +//void cvAbsDiffS(const CvArr* src, CvArr* dst, CvScalar value) +procedure cvAbsDiffS(const src: pCvArr; dst: pCvArr;value:TCvScalar); cdecl; + +//CVAPI(void) cvSort( const CvArr* src, CvArr* dst CV_DEFAULT(NULL), +// CvArr* idxmat CV_DEFAULT(NULL), +// int flags CV_DEFAULT(0)); +procedure cvSort(const src:pCvArr; dst : pCvArr = nil; + idxmat :pCvArr=nil; + flags : integer =0); cdecl; + function cvGet(const mat: pCvMat; i, j: Integer): Single; {$IFDEF USE_INLINE} inline; {$ENDIF} // procedure cvCopyImage(const src: pIplImage; dst: pIplImage; const mask: pIplImage = nil); cdecl; overload; // procedure cvCopyImage(const src: pCvArr; dst: pCvArr; const mask: pCvArr = nil); cdecl; overload; @@ -841,13 +881,14 @@ procedure cvRandArr(rng: pCvRNG; arr: pCvArr; dist_type: Integer; param1: TCvSca // CVAPI(void)cvRandShuffle(CvArr * mat, CvRNG * rng, double iter_factor CV_DEFAULT(1. )); procedure cvRandShuffle(mat: pCvArr; rng: pCvRNG; iter_factor: double = 1); cdecl; + (* CVAPI(void) cvSort( const CvArr* src, CvArr* dst CV_DEFAULT(NULL), CvArr* idxmat CV_DEFAULT(NULL), int flags CV_DEFAULT(0)); *) +//procedure cvSort(const src: pCvArr; dst: pCvArr = nil; idxmat: pCvArr = nil; flags: Integer = 0); cdecl; -procedure cvSort(const src: pCvArr; dst: pCvArr = nil; idxmat: pCvArr = nil; flags: Integer = 0); cdecl; (* Finds real roots of a cubic equation *) @@ -1242,6 +1283,14 @@ procedure cvDCT(const src: pCvArr; dst: pCvArr; flags: Integer); cdecl; *) function cvSliceLength(slice: TCvSlice; const seq: pCvSeq): Integer; cdecl; +//* Remember a storage "free memory" position */ +//CVAPI(void) cvSaveMemStoragePos( const CvMemStorage* storage, CvMemStoragePos* pos ); +procedure cvSaveMemStoragePos(const storage:pCvMemStorage; pos:pCvMemStoragePos); cdecl; + +//* Restore a storage "free memory" position */ +//CVAPI(void) cvRestoreMemStoragePos( CvMemStorage* storage, CvMemStoragePos* pos ); +procedure cvRestoreMemStoragePos(storage:pCvMemStorage; pos:pCvMemStoragePos); cdecl; + { Creates new memory storage. block_size == 0 means that default, somewhat optimal size, is used (currently, it is 64K) @@ -1283,6 +1332,11 @@ function cvMemStorageAlloc(storage: pCvMemStorage; size: size_t): Pointer; cdecl function cvMemStorageAllocString(storage: pCvMemStorage; const ptr: pCvChar; len: Integer = -1): TCvString; cdecl; +//* Changes default size (granularity) of sequence blocks. +// The default size is ~1Kbyte */ +//CVAPI(void) cvSetSeqBlockSize( CvSeq* seq, int delta_elems ); +procedure cvSetSeqBlockSize( seq:pCvSeq; delta_elems:Integer ); cdecl; + { Creates new empty sequence that will reside in the specified storage CVAPI(CvSeq*) cvCreateSeq( int seq_flags, size_t header_size, size_t elem_size, CvMemStorage* storage ); @@ -1309,6 +1363,27 @@ function cvSeqPush(seq: pCvSeq; const element: Pointer = nil): Pointer; cdecl; *) function cvSeqPushFront(seq: pCvSeq; const element: Pointer = nil): pschar; cdecl; +//* Removes the last element from sequence and optionally saves it */ +//CVAPI(void) cvSeqPop( CvSeq* seq, void* element CV_DEFAULT(NULL)); +procedure cvSeqPop(seq:pCvSeq; element : pointer = nil);cdecl; + +//* Removes the first element from sequence and optioanally saves it */ +//CVAPI(void) cvSeqPopFront( CvSeq* seq, void* element CV_DEFAULT(NULL)); +procedure cvSeqPopFront(seq:pCvSeq; element :pointer = nil); cdecl; + +const + CV_FRONT = 1; + CV_BACK = 0; +//* Adds several new elements to the end of sequence */ +//CVAPI(void) cvSeqPushMulti( CvSeq* seq, const void* elements, +// int count, int in_front CV_DEFAULT(0) ); +procedure cvSeqPushMulti(seq:pCvSeq; const elements:pointer; count:Integer; in_front:integer = 0); cdecl; + +//* Removes several elements from the end of sequence and optionally saves them */ +//CVAPI(void) cvSeqPopMulti( CvSeq* seq, void* elements, +// int count, int in_front CV_DEFAULT(0) ); +procedure cvSeqPopMulti(seq:pCvSeq; elements:pointer; count:integer; in_front:integer=0); cdecl; + (* Inserts a new element in the middle of sequence. cvSeqInsert(seq,0,elem) == cvSeqPushFront(seq,elem) @@ -1334,6 +1409,18 @@ function cvGetSeqElem(const seq: pCvSeq; index: Integer): Pointer; cdecl; *) function cvSeqElemIdx(const seq: pCvSeq; const element: Pointer; block: pCvSeqBlockArray = nil): Integer; cdecl; +//* Initializes sequence writer. The new elements will be added to the end of sequence */ +//CVAPI(void) cvStartAppendToSeq( CvSeq* seq, CvSeqWriter* writer ); +procedure cvStartAppendToSeq(seq:pCvSeq; writer:pCvSeqWriter); cdecl; + +//* Combination of cvCreateSeq and cvStartAppendToSeq */ +//CVAPI(void) cvStartWriteSeq( int seq_flags, int header_size, +// int elem_size, CvMemStorage* storage, +// CvSeqWriter* writer ); +procedure cvStartWriteSeq( seq_flags:integer; header_size:Integer; + elem_size:Integer; storage:pCvMemStorage; + writer:pCvSeqWriter); cdecl; + (* Closes sequence writer, updates sequence header and returns pointer to the resultant sequence @@ -1343,6 +1430,11 @@ function cvSeqElemIdx(const seq: pCvSeq; const element: Pointer; block: pCvSeqBl *) function cvEndWriteSeq(writer: pCvSeqWriter): pCvSeq; cdecl; +//* Updates sequence header. May be useful to get access to some of previously +// written elements via cvGetSeqElem or sequence reader */ +//CVAPI(void) cvFlushSeqWriter( CvSeqWriter* writer ); +procedure cvFlushSeqWriter( writer:pCvSeqWriter ); cdecl; + { Initializes sequence reader. The sequence can be read in forward or backward direction CVAPI(void) cvStartReadSeq( const CvSeq* seq, CvSeqReader* reader, int reverse CV_DEFAULT(0) ); @@ -1356,6 +1448,11 @@ procedure cvStartReadSeq(const seq: Pointer; reader: pCvSeqReader; reverse: Inte *) function cvGetSeqReaderPos(reader: pCvSeqReader): Integer; cdecl; +//* Changes sequence reader position. It may seek to an absolute or +// to relative to the current position */ +//CVAPI(void) cvSetSeqReaderPos( CvSeqReader* reader, int index, int is_relative CV_DEFAULT(0)); +procedure cvSetSeqReaderPos(reader:pCvSeqReader; index:Integer; is_relative :Integer = 0); cdecl; + { Copies sequence content to a continuous piece of memory CVAPI(void*) cvCvtSeqToArray( const CvSeq* seq, void* elements, CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ)); } procedure cvCvtSeqToArray(const seq: pCvSeq; elements: pCvArr; slice: TCvSlice { =CV_WHOLE_SEQ } ); cdecl; @@ -1381,6 +1478,23 @@ function cvMakeSeqHeaderForArray(seq_type: Integer; header_size: Integer; elem_s *) function cvSeqSlice(const seq: pCvSeq; slice: TCvSlice; storage: pCvMemStorage = nil; copy_data: Integer = 0): pCvSeq; cdecl; +//* Removes sequence slice */ +//CVAPI(void) cvSeqRemoveSlice( CvSeq* seq, CvSlice slice ); +procedure cvSeqRemoveSlice( seq:pCvSeq; slice :TCvSlice); cdecl; + +//* Inserts a sequence or array into another sequence */ +//CVAPI(void) cvSeqInsertSlice( CvSeq* seq, int before_index, const CvArr* from_arr ); +procedure cvSeqInsertSlice(seq:pCvSeq; before_index:integer; const from_arr:pCvArr);cdecl; + +//* a < b ? -1 : a > b ? 1 : 0 */ +//typedef int (CV_CDECL* CvCmpFunc)(const void* a, const void* b, void* userdata ); +type + TCvCmpFunc = function(const a:pointer; const b:pointer; userdata: pointer):integer;cdecl; + +//* Sorts sequence in-place given element comparison function */ +//CVAPI(void) cvSeqSort( CvSeq* seq, CvCmpFunc func, void* userdata CV_DEFAULT(NULL) ); +procedure cvSeqSort(seq:pCvSeq; func:TCvCmpFunc; userdata:pointer = nil); cdecl; + // ************ Internal sequence functions ************/ // CVAPI(void) cvChangeSeqBlock( void* reader, int direction ); @@ -1595,6 +1709,23 @@ function cvNextGraphItem(scanner: pCvGraphScanner): Integer; cdecl; function cvCloneGraph(const graph: pCvGraph; storage: pCvMemStorage): pCvGraph; cdecl; +//* Draws a rectangle specified by a CvRect structure */ +//CVAPI(void) cvRectangleR( CvArr* img, CvRect r, +// CvScalar color, int thickness CV_DEFAULT(1), +// int line_type CV_DEFAULT(8), +// int shift CV_DEFAULT(0)); +procedure cvRectangleR( img:pCvArr; r:TCvRect; color:TCvScalar; thickness:integer=1; + line_type :integer =8; + shift:integer=0); cdecl; + +//* Fills an area bounded by one or more arbitrary polygons */ +//CVAPI(void) cvFillPoly( CvArr* img, CvPoint** pts, const int* npts, +// int contours, CvScalar color, +// int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) ); +procedure cvFillPoly( img:pCvArr; pts:pCvPointArray; const npts:pInteger; + contours:Integer; color:TCvScalar; + line_type :Integer=8; shift :Integer=0 ); cdecl; + (* Does look-up transformation. Elements of the source array (that should be 8uC1 or 8sC1) are used as indexes in lutarr 256-element table @@ -1611,6 +1742,14 @@ procedure cvLUT(const src: pCvArr; dst: pCvArr; const lut: pCvArr); cdecl; *) function cvSetAdd(set_header: pCvSet; elem: pCvSetElem = nil; inserted_elem: pCvSetElemArray = nil): Integer; cdecl; +//* Removes element from the set by its index */ +//CVAPI(void) cvSetRemove( CvSet* set_header, int index ); +procedure cvSetRemove(set_header:pCvSet; index:Integer );cdecl; + +//* Removes all the elements from the set */ +//CVAPI(void) cvClearSet( CvSet* set_header ); +procedure cvClearSet( set_header:pCvSet ); cdecl; + // * writes an integer */ // CVAPI(void) cvWriteInt( CvFileStorage* fs, const char* name, int value ); procedure cvWriteInt(fs: pCvFileStorage; const name: pCvChar; value: Integer); cdecl; @@ -1677,9 +1816,6 @@ function cvGetRootFileNode(const fs: pCvFileStorage; stream_index: Integer = 0): function cvGetFileNode(fs: pCvFileStorage; map: pCvFileNode; const key: pCvStringHashNode; create_missing: Integer = 0): pCvFileNode; cdecl; -type - TCvCmpFunc = function(const A: Pointer; const B: Pointer; userdata: Pointer): Integer; cdecl; - function cvSeqPartition(const seq: pCvSeq; storage: pCvMemStorage; labels: pCvSeq; is_equal: TCvCmpFunc; userdata: Pointer): Integer; cdecl; (* @@ -1691,6 +1827,10 @@ function cvSeqPartition(const seq: pCvSeq; storage: pCvMemStorage; labels: pCvSe *) function cvSeqSearch(seq: pCvSeq; const elem: Pointer; func: TCvCmpFunc; is_sorted: Integer; elem_idx: pInteger; userdata: Pointer = nil): pschar; cdecl; +//* Reverses order of sequence elements in-place */ +//CVAPI(void) cvSeqInvert( CvSeq* seq ); +procedure cvSeqInvert( seq:pCvSeq );cdecl; + { **************************************************************************************** * Drawing * **************************************************************************************** } @@ -1735,10 +1875,11 @@ procedure cvCircle(img: pCvArr; center: TCvPoint; radius: Integer; color: TCvSca procedure cvEllipse(img: pCvArr; center: TCvPoint; axes: TCvSize; angle: double; start_angle: double; nd_angle: double; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); cdecl; -{ CV_INLINE void cvEllipseBox( pCvArr* img, CvBox2D box, CvScalar color, +{ +CV_INLINE void cvEllipseBox( pCvArr* img, CvBox2D box, CvScalar color, int thickness CV_DEFAULT(1), int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) ) - { +}{ CvSize axes; axes.width = cvRound(box.size.width*0.5); axes.height = cvRound(box.size.height*0.5); @@ -1747,7 +1888,8 @@ procedure cvEllipse(img: pCvArr; center: TCvPoint; axes: TCvSize; angle: double; } procedure cvEllipseBox(img: pCvArr; box: TCvBox2D; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); {$IFDEF USE_INLINE} inline; {$ENDIF} -{ Fills convex or monotonous polygon. +{ + Fills convex or monotonous polygon. CVAPI(void) cvFillConvexPoly( pCvArr* img, const CvPoint* pts, int npts, CvScalar color, int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0)); } @@ -2027,6 +2169,18 @@ procedure cvReleaseFileStorage(var fs: pCvFileStorage); cdecl; *) function cvAttrValue(const attr: pCvAttrList; const attr_name: pCvChar): pCvChar; cdecl; +//* starts writing compound structure (map or sequence) */ +//CVAPI(void) cvStartWriteStruct( CvFileStorage* fs, const char* name, +// int struct_flags, const char* type_name CV_DEFAULT(NULL), +// CvAttrList attributes CV_DEFAULT(cvAttrList())); +procedure cvStartWriteStruct( fs:pCvFileStorage; const name:pCVChar; + struct_flags:Integer; const type_name :pCVChar; + attributes:TCvAttrList); cdecl; + +//* finishes writing compound structure */ +//CVAPI(void) cvEndWriteStruct( CvFileStorage* fs ); +procedure cvEndWriteStruct(fs:pCvFileStorage );cdecl; + { this is a slower version of cvGetFileNode that takes the key as a literal string CVAPI(CvFileNode*) cvGetFileNodeByName( const CvFileStorage* fs, const CvFileNode* map, const char* name ); @@ -2041,29 +2195,32 @@ function cvGetFileNodeByName(const fs: pCvFileStorage; const map: pCvFileNode; c function cvReadInt(const node: pCvFileNode; default_value: Integer = 0): Integer; {$IFDEF USE_INLINE} inline; {$ENDIF} { CV_INLINE int cvReadIntByName( const CvFileStorage* fs, const CvFileNode* map, const char* name, int default_value CV_DEFAULT(0) ) - { +}{ return cvReadInt( cvGetFileNodeByName( fs, map, name ), default_value ); } function cvReadIntByName(const fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar; default_value: Integer = 0): Integer; {$IFDEF USE_INLINE} inline; {$ENDIF} -// CV_INLINE const char* cvReadString( const CvFileNode* node, -// const char* default_value CV_DEFAULT(NULL) ) -// { -// return !node ? default_value : CV_NODE_IS_STRING(node->tag) ? node->data.str.ptr : 0; -// } +{ + CV_INLINE const char* cvReadString( const CvFileNode* node, + const char* default_value CV_DEFAULT(NULL) ) + }{ + return !node ? default_value : CV_NODE_IS_STRING(node->tag) ? node->data.str.ptr : 0; +} function cvReadString(const node: pCvFileNode; const default_value: pCvChar = nil): pCvChar; {$IFDEF USE_INLINE} inline; {$ENDIF} -// CV_INLINE const char* cvReadStringByName( const CvFileStorage* fs, const CvFileNode* map, -// const char* name, const char* default_value CV_DEFAULT(NULL) ) -// { -// return cvReadString( cvGetFileNodeByName( fs, map, name ), default_value ); -// } +{ + CV_INLINE const char* cvReadStringByName( const CvFileStorage* fs, const CvFileNode* map, + const char* name, const char* default_value CV_DEFAULT(NULL) ) + }{ + return cvReadString( cvGetFileNodeByName( fs, map, name ), default_value ); + } function cvReadStringByName(const fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar; const default_value: pCvChar = nil): pCvChar; {$IFDEF USE_INLINE} inline; {$ENDIF} -{ decodes standard or user-defined object and returns it +{ + decodes standard or user-defined object and returns it CVAPI(void*) cvRead( CvFileStorage* fs, CvFileNode* node, CvAttrList* attributes CV_DEFAULT(NULL)); } @@ -2153,7 +2310,8 @@ procedure cvRelease(var struct_ptr: pCvSeq); cdecl; overload; *) function cvClone(const struct_ptr: Pointer): Pointer; cdecl; -{ simple API for reading/writing data +{ + simple API for reading/writing data CVAPI(void) cvSave( const char* filename, const void* struct_ptr, const char* name CV_DEFAULT(NULL), @@ -2315,78 +2473,81 @@ implementation uses ocv.lib; -function cvCreateImageHeader; external core_lib; -function cvInitImageHeader; external core_lib; -function cvCreateImage; external core_lib; -procedure cvReleaseImageHeader; external core_lib; -procedure cvReleaseImage; external core_lib; -function cvCloneImage; external core_lib; -procedure cvSetImageCOI; external core_lib; -function cvGetImageCOI; external core_lib; -procedure cvSetImageROI; external core_lib; -procedure cvResetImageROI; external core_lib; -function cvGetImageROI; external core_lib; -function cvCreateMatHeader; external core_lib; -function cvInitMatHeader; external core_lib; -function cvCreateMat; external core_lib; -procedure cvReleaseMat; external core_lib; -function cvCloneMat; external core_lib; -function cvGetSubRect; external core_lib; -procedure cvGetSubArr; external core_lib name 'cvGetSubRect'; +function cvCreateImageHeader(size: TCvSize; depth: Integer; channels: Integer): pIplImage; cdecl; external core_lib; +function cvInitImageHeader(image: pIplImage; size: TCvSize; depth: Integer; channels: Integer; origin: Integer = 0; align: Integer = 4): pIplImage; cdecl; external core_lib; +function cvCreateImage(size: TCvSize; depth, channels: Integer): pIplImage; cdecl; external core_lib; +procedure cvReleaseImageHeader(var image: pIplImage); cdecl; external core_lib; +procedure cvReleaseImage(var image: pIplImage); cdecl; external core_lib; +function cvCloneImage(const image: pIplImage): pIplImage; cdecl; external core_lib; +procedure cvSetImageCOI(image: pIplImage; coi: Integer); cdecl; external core_lib; +function cvGetImageCOI(const image: pIplImage): Integer; cdecl; external core_lib; +procedure cvSetImageROI(image: pIplImage; rect: TCvRect); cdecl; external core_lib; +procedure cvResetImageROI(image: pIplImage); cdecl; external core_lib; +function cvGetImageROI(const image: pIplImage): TCvRect; cdecl; external core_lib; +function cvCreateMatHeader(rows: Integer; cols: Integer; cType: Integer): pCvMat; cdecl; external core_lib; +function cvInitMatHeader(mat: pCvMat; rows: Integer; cols: Integer; _type: Integer; data: Pointer = nil; step: Integer = CV_AUTOSTEP): pCvMat; cdecl; external core_lib; +function cvCreateMat(rows, cols, cType: Integer): pCvMat; cdecl; external core_lib; +procedure cvReleaseMat(var mat: pCvMat); cdecl; external core_lib; +function cvCloneMat(const mat: pCvMat): pCvMat; cdecl; external core_lib; +function cvGetSubRect(arr: pCvArr; submat: pCvArr; rect: TCvRect): pCvMat; cdecl; external core_lib; +function cvGetSubArr(arr: pCvArr; submat: pCvArr; rect: TCvRect): pCvMat; cdecl; external core_lib name 'cvGetSubRect'; function cvGetRow(const arr: pCvArr; submat: pCvMat; row: Integer): pCvMat; begin result := cvGetRows(arr, submat, row, row + 1, 1); end; -function cvGetCols; external core_lib; + +function cvGetCols(const arr: pCvArr; submat: pCvMat; start_col, end_col: Integer): pCvMat; cdecl; external core_lib; function cvGetCol(const arr: pCvArr; submat: pCvMat; col: Integer): pCvMat; begin result := cvGetCols(arr, submat, col, col + 1); end; -function cvGetDiag; external core_lib; -procedure cvScalarToRawData; external core_lib; -procedure cvRawDataToScalar; external core_lib; -function cvCreateMatNDHeader; external core_lib; -function cvCreateMatND; external core_lib; -function cvInitMatNDHeader; external core_lib; +function cvGetDiag(const arr: pCvArr; submat: pCvMat; diag: Integer = 0): pCvMat; cdecl; external core_lib; +procedure cvScalarToRawData(const scalar: pCvScalar; data: pCvArr; cType: Integer; extend_to_12: Integer = 0); cdecl; external core_lib; +procedure cvRawDataToScalar(const data: pCvArr; cType: Integer; scalar: pCvScalar); cdecl; external core_lib; +function cvCreateMatNDHeader(dims: Integer; const sizes: pInteger; cType: Integer): pCvMatND; cdecl;external core_lib; +function cvCreateMatND(dims: Integer; const sizes: pInteger; cType: Integer):pCvMatND; cdecl;external core_lib; + +function cvInitMatNDHeader(mat: pCvMatND; dims: Integer; const sizes: pInteger; cType: Integer; data: pCvArr = nil):pCvMatND; cdecl; external core_lib; procedure cvReleaseMatND(var mat: pCvMatND); {$IFDEF USE_INLINE} inline; {$ENDIF} begin cvReleaseMat(pCvMat(mat)); end; -function cvCloneMatND; external core_lib; +function cvCloneMatND(const mat: pCvMatND):pCvMatND; cdecl; external core_lib; -function cvCreateSparseMat; external core_lib; +function cvCreateSparseMat(dims: Integer; sizes: pInteger; cType: Integer):pCvSparseMat; cdecl; external core_lib; -procedure cvReleaseSparseMat; external core_lib; +procedure cvReleaseSparseMat(mat: pCvSparseMat); cdecl; cdecl; external core_lib; -function cvCloneSparseMat; external core_lib; +function cvCloneSparseMat(const mat: pCvSparseMat):pCvSparseMat; cdecl; external core_lib; -function cvInitSparseMatIterator; external core_lib; +function cvInitSparseMatIterator(const mat: pCvSparseMat; mat_iterator: pCvSparseMatIterator):pCvSparseNode; cdecl; external core_lib; -// returns next sparse array node (or NULL if there is no more nodes) -// CV_INLINE CvSparseNode* cvGetNextSparseNode( CvSparseMatIterator* mat_iterator ) -// { -// if( mat_iterator->node->next ) -// return mat_iterator->node = mat_iterator->node->next; -// else -// { -// int idx; -// for( idx = ++mat_iterator->curidx; idx < mat_iterator->mat->hashsize; idx++ ) -// { -// CvSparseNode* node = (CvSparseNode*)mat_iterator->mat->hashtable[idx]; -// if( node ) -// { -// mat_iterator->curidx = idx; -// return mat_iterator->node = node; -// } -// } -// return NULL; -// } -// } +{ + returns next sparse array node (or NULL if there is no more nodes) + CV_INLINE CvSparseNode* cvGetNextSparseNode( CvSparseMatIterator* mat_iterator ) + }{ + if( mat_iterator->node->next ) + return mat_iterator->node = mat_iterator->node->next; + else + }{ + int idx; + for( idx = ++mat_iterator->curidx; idx < mat_iterator->mat->hashsize; idx++ ) + }{ + CvSparseNode* node = (CvSparseNode*)mat_iterator->mat->hashtable[idx]; + if( node ) + }{ + mat_iterator->curidx = idx; + return mat_iterator->node = node; + }{ + }{ + return NULL; + }{ + } {$IFDEF DELPHIXE_UP} @@ -2395,22 +2556,22 @@ var idx: Integer; node: pCvSparseNode; begin - if Assigned(mat_iterator.node.next) then + if Assigned(mat_iterator^.node^.next) then begin - mat_iterator.node := mat_iterator.node.next; - result := mat_iterator.node; + mat_iterator^.node := mat_iterator^.node^.next; + result := mat_iterator^.node; end else begin - Inc(mat_iterator.curidx); - for idx := mat_iterator.curidx to mat_iterator.mat.hashsize - 1 do + Inc(mat_iterator^.curidx); + for idx := mat_iterator^.curidx to mat_iterator^.mat^.hashsize - 1 do begin - node := mat_iterator.mat.hashtable[idx]; + node := mat_iterator^.mat^.hashtable[idx]; if Assigned(node) then begin - mat_iterator.curidx := idx; - mat_iterator.node := node; - result := mat_iterator.node; + mat_iterator^.curidx := idx; + mat_iterator^.node := node; + result := mat_iterator^.node; exit; end; end; @@ -2418,31 +2579,31 @@ begin end; end; {$ENDIF} -function cvInitNArrayIterator; external core_lib; +function cvInitNArrayIterator(count: Integer; arrs: pCvArr; const mask: pCvArr; stubs: pCvMatND; array_iterator: pCvNArrayIterator; flags: Integer = 0): Integer; cdecl; external core_lib; -function cvNextNArraySlice; external core_lib; +function cvNextNArraySlice(array_iterator: pCvNArrayIterator): Integer; cdecl; external core_lib; -function cvGetElemType; external core_lib; +function cvGetElemType(const arr: pCvArr): Integer; cdecl; external core_lib; -function cvGetDims; external core_lib; +function cvGetDims(const arr: pCvArr; sizes: pInteger = nil): Integer; cdecl; external core_lib; -function cvGetDimSize; external core_lib; +function cvGetDimSize(const arr: pCvArr; index: Integer): Integer; cdecl; external core_lib; -function cvPtr1D; external core_lib; +function cvPtr1D(const arr: pCvArr; idx0: Integer; cType: pInteger = nil): pCvArr; cdecl; external core_lib; -function cvPtr2D; external core_lib; +function cvPtr2D(const arr: pCvArr; idx0, idx1: Integer; cType: pInteger = nil): pCvArr; cdecl; external core_lib; -function cvPtr3D; external core_lib; +function cvPtr3D(const arr: pCvArr; idx0, idx1, idx2: Integer; cType: pInteger = nil): pCvArr; cdecl; external core_lib; -function cvPtrND; external core_lib; +function cvPtrND(const arr: pCvArr; idx: pInteger; cType: pInteger = nil; create_node: Integer = 1; precalc_hashval: punsigned = nil): pCvArr; cdecl; external core_lib; -function cvGet1D; external core_lib; +function cvGet1D(const arr: pCvArr; idx0: Integer): TCvScalar; cdecl; external core_lib; -function cvGet2D; external core_lib; +function cvGet2D(const arr: pCvArr; idx0, idx1: Integer): TCvScalar; cdecl; external core_lib; -function cvGet3D; external core_lib; +function cvGet3D(const arr: pCvArr; idx0, idx1, idx2: Integer): TCvScalar; cdecl; external core_lib; -function cvGetND; external core_lib; +function cvGetND(const arr: pCvArr; idx: pInteger): TCvScalar; cdecl; external core_lib; // function cvGetReal1D(const arr: pIplImage; idx0: Integer): double; cdecl; external core_lib; overload; function cvGetReal1D(const arr: pCvArr; idx0: Integer): double; cdecl; external core_lib; overload; @@ -2450,33 +2611,33 @@ function cvGetReal1D(const arr: pCvArr; idx0: Integer): double; cdecl; external // function cvGetReal2D(const arr: pCvMat; idx0, idx1: Integer): double; cdecl; external core_lib; overload; function cvGetReal2D(const arr: pCvArr; idx0, idx1: Integer): double; cdecl; external core_lib; overload; -function cvGetReal3D; external core_lib; +function cvGetReal3D(const arr: pCvArr; idx0, idx1, idx2: Integer): double; cdecl; external core_lib; -function cvGetRealND; external core_lib; +function cvGetRealND(const arr: pCvArr; idx: pInteger): double; cdecl; external core_lib; -procedure cvSet1D; external core_lib; +procedure cvSet1D(arr: pCvArr; idx0: Integer; value: TCvScalar); cdecl; external core_lib; -procedure cvSet2D; external core_lib; +procedure cvSet2D(arr: pCvArr; idx0, idx1: Integer; value: TCvScalar); cdecl; external core_lib; -procedure cvSet3D; external core_lib; +procedure cvSet3D(arr: pCvArr; idx0, idx1, idx2: Integer; value: TCvScalar); cdecl; external core_lib; -procedure cvSetND; external core_lib; +procedure cvSetND(arr: pCvArr; idx: pInteger; value: TCvScalar); cdecl; external core_lib; -procedure cvSetReal1D; external core_lib; +procedure cvSetReal1D(arr: pCvArr; idx0: Integer; value: double); cdecl; external core_lib; -procedure cvSetReal2D; external core_lib; +procedure cvSetReal2D(arr: pCvArr; idx0, idx1: Integer; value: double); cdecl; external core_lib; -procedure cvSetReal3D; external core_lib; +procedure cvSetReal3D(arr: pCvArr; idx0, idx1, idx2: Integer; value: double); cdecl; external core_lib; -procedure cvSetRealND; external core_lib; +procedure cvSetRealND(arr: pCvArr; idx: pInteger; value: double); cdecl; external core_lib; -procedure cvClearND; external core_lib; +procedure cvClearND(arr: pCvArr; idx: pInteger); cdecl; external core_lib; -function cvGetMat; external core_lib; +function cvGetMat(const arr: pCvArr; header: pCvMat; coi: pInteger = nil; allowND: Integer = 0): pCvMat; cdecl; external core_lib; -function cvGetImage; external core_lib; +function cvGetImage(const arr: pCvArr; image_header: pIplImage): pIplImage; cdecl; external core_lib; -function cvReshapeMatND; external core_lib; +function cvReshapeMatND(const arr: pCvArr; sizeof_header: Integer; header: pCvArr; new_cn, new_dims: Integer; new_sizes: pInteger): pCvArr; cdecl; external core_lib; function cvReshapeND(const arr: pCvArr; sizeof_header: Integer; header: pCvArr; new_cn, new_dims: Integer; new_sizes: pInteger): pCvArr; {$IFDEF USE_INLINE} inline; {$ENDIF} @@ -2484,17 +2645,17 @@ begin result := cvReshapeMatND(arr, sizeof(sizeof_header), header, new_cn, new_dims, new_sizes); end; -function cvReshape; external core_lib; +function cvReshape(const arr: pCvArr; header: pCvMat; new_cn: Integer; new_rows: Integer = 0): pCvMat; cdecl; external core_lib; -procedure cvRepeat; external core_lib; +procedure cvRepeat(src, dst: pCvArr); cdecl; external core_lib; -procedure cvCreateData; external core_lib; +procedure cvCreateData(arr: pCvArr); cdecl; external core_lib; -procedure cvReleaseData; external core_lib; +procedure cvReleaseData(arr: pCvArr); cdecl; external core_lib; -procedure cvSetData; external core_lib; +procedure cvSetData(arr: pCvArr; data: Pointer; step: Integer); cdecl; external core_lib; -procedure cvGetRawData; external core_lib; +procedure cvGetRawData(arr: pCvArr; data: pByte; step: pInteger = nil; roi_size: pCvSize = nil); cdecl; external core_lib; {$IF DEFINED(DelphiOCVVersion_29)} // {$IFDEF VER290} @@ -2514,8 +2675,10 @@ asm pop ecx // mov ecx, edx // _cvGetSize pop edx // Result - mov Result.width, eax - mov Result.height, ecx +// mov Result.width, eax + mov DWORD PTR [ebp-$08],eax +// mov Result.height, ecx + mov DWORD PTR [ebp-$04],ecx end; {$ENDIF CPU32} {$IFDEF CPU64} @@ -2537,7 +2700,7 @@ function cvGetSize(const arr: pCvArr): TCvSize; external core_lib; procedure cvCopy(const src: pCvArr; dst: pCvArr; const mask: pCvArr = nil); cdecl; external core_lib; overload; // procedure cvCopy(const src: pIplImage; dst: pIplImage; const mask: pIplImage = nil); cdecl; external core_lib; overload; -procedure cvSet(arr: pCvArr; value: TCvScalar; const mask: pCvArr = Nil); external core_lib; +procedure cvSet(arr: pCvArr; value: TCvScalar; const mask: pCvArr = Nil); cdecl; external core_lib; procedure cvSet(mat: pCvMat; i, j: Integer; val: Single); {$IFDEF USE_INLINE} inline; {$ENDIF} var @@ -2546,41 +2709,42 @@ var pf: PSingle; begin // type_ := CV_MAT_TYPE(mat._type); - assert((i < mat^.rows) and (j < mat^.cols) and (CV_MAT_TYPE(mat._type) = CV_32FC1)); + assert((i < mat^.rows) and (j < mat^.cols) and (CV_MAT_TYPE(mat^._type) = CV_32FC1)); ptr := mat^.data.ptr; - Inc(ptr, mat.step * i + sizeof(Single) * j); + Inc(ptr, mat^.step * i + sizeof(Single) * j); pf := PSingle(ptr); pf^ := val; end; -procedure cvSetZero; external core_lib; +procedure cvSetZero(arr: pCvArr); cdecl; external core_lib; -procedure cvZero; external core_lib name 'cvSetZero'; +procedure cvZero(arr: pCvArr); cdecl; external core_lib name 'cvSetZero'; -procedure cvSplit; external core_lib; +procedure cvSplit(const src: pCvArr; dst0: pCvArr; dst1: pCvArr; dst2: pCvArr = nil; dst3: pCvArr = nil); cdecl; external core_lib; // procedure cvMerge(const src0: pIplImage; const src1: pIplImage; const src2: pIplImage; const src3: pIplImage; dst: pIplImage); cdecl; // external core_lib; overload; procedure cvMerge(const src0: pCvArr; const src1: pCvArr; const src2: pCvArr; const src3: pCvArr; dst: pCvArr); cdecl; external core_lib; overload; -procedure cvMixChannels; external core_lib; +procedure cvMixChannels(src: array of pCvArr; src_count: Integer; dst: array of pCvArr; dst_count: Integer; const from_to: pInteger; + pair_count: Integer); cdecl; external core_lib; -procedure cvConvertScale; external core_lib; +procedure cvConvertScale(const src: pCvArr; dst: pCvArr; scale: double = 1; shift: double = 0); cdecl; external core_lib; procedure cvConvert(const src: pCvArr; dst: pCvArr); {$IFDEF USE_INLINE} inline; {$ENDIF} begin cvConvertScale(src, dst, 1, 0); end; -procedure cvScale; external core_lib name 'cvConvertScale'; +procedure cvScale(const src: pCvArr; dst: pCvArr; scale: double = 1; shift: double = 0); cdecl; external core_lib name 'cvConvertScale'; -procedure cvCvtScale; external core_lib name 'cvConvertScale'; +procedure cvCvtScale(const src: pCvArr; dst: pCvArr; scale: double = 1; shift: double = 0); cdecl; external core_lib name 'cvConvertScale'; -procedure cvConvertScaleAbs; external core_lib; +procedure cvConvertScaleAbs(const src: pCvArr; dst: pCvArr; scale: double = 1; shift: double = 0); cdecl; external core_lib; -procedure cvCvtScaleAbs; external core_lib name 'cvConvertScaleAbs'; +procedure cvCvtScaleAbs; cdecl; external core_lib name 'cvConvertScaleAbs'; -function cvCheckTermCriteria; external core_lib; +function cvCheckTermCriteria(criteria: TCvTermCriteria; default_eps: double; default_max_iters: Integer): TCvTermCriteria; cdecl; external core_lib; // procedure cvAdd; external core_lib; // procedure cvAdd(const src1, src2: pIplImage; dst: pIplImage; const mask: pIplImage = nil); cdecl; external core_lib; overload; @@ -2636,24 +2800,25 @@ end; // external core_lib; overload; procedure cvAddWeighted(const src1: pCvArr; alpha: double; const src2: pCvArr; beta: double; gamma: double; dst: pCvArr); cdecl; external core_lib; overload; -function cvDotProduct; external core_lib; +function cvDotProduct(const src1, src2: pCvArr): double; cdecl; external core_lib; -function cvAlloc(size: NativeUInt): Pointer; external core_lib; +function cvAlloc(size: NativeUInt): Pointer; cdecl; external core_lib; -procedure cvFree_(ptr: Pointer); external core_lib; +procedure cvFree_(ptr: Pointer); cdecl; external core_lib; -procedure cvInitFont; external core_lib; +procedure cvInitFont(font: pCvFont; font_face: Integer; hscale: double; vscale: double; shear: double = 0; thickness: Integer = 1; + line_type: Integer = 8); cdecl; external core_lib; -procedure cvPutText; external core_lib; +procedure cvPutText(img: pCvArr; const text: pCvChar; org: TCvPoint; const font: pCvFont; color: TCvScalar); cdecl; external core_lib; function cvFont(scale: double; thickness: Integer = 1): TCvFont; {$IFDEF USE_INLINE} inline; {$ENDIF} begin cvInitFont(@result, CV_FONT_HERSHEY_PLAIN, scale, scale, 0, thickness, CV_AA); end; -procedure cvCircle; external core_lib; +procedure cvCircle(img: pCvArr; center: TCvPoint; radius: Integer; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); cdecl; external core_lib; -procedure cvLine; external core_lib; +procedure cvLine(img: pCvArr; pt1, pt2: TCvPoint; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); cdecl; external core_lib; // procedure cvCopyImage; external core_lib name 'cvCopy'; // procedure cvCopyImage(const src: pIplImage; dst: pIplImage; const mask: pIplImage = nil); cdecl; external core_lib name 'cvCopy'; overload; @@ -2664,7 +2829,7 @@ begin result := CvScalar(B, g, r, 0); end; -procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar; const comment: pCvChar; attributes: TCvAttrList); +procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar; const comment: pCvChar; attributes: TCvAttrList); cdecl; external core_lib; overload; procedure cvSave(const filename: pCvChar; const struct_ptr: Pointer; const name: pCvChar = Nil; const comment: pCvChar = Nil); overload; @@ -2673,7 +2838,7 @@ begin cvSave(filename, struct_ptr, name, comment, ZeroCvAttrList); end; -function cvLoad; external core_lib; +function cvLoad(const filename: pCvChar; memstorage: pCvMemStorage = Nil; const name: pCvChar = nil; const real_name: ppCvChar = nil): Pointer; cdecl; external core_lib; // procedure cvInRange; external core_lib; // procedure cvInRange(const src: pIplImage; const lower: pIplImage; const upper: pIplImage; dst: pIplImage); cdecl; @@ -2694,34 +2859,35 @@ procedure cvMinMaxLoc(const arr: pCvArr; min_val: pDouble; max_val: pDouble; min // procedure cvAnd(const src1: pIplImage; const src2: pIplImage; dst: pIplImage; masl: pIplImage = nil); cdecl; external core_lib; overload; procedure cvAnd(const src1: pCvArr; const src2: pCvArr; dst: pCvArr; masl: pCvArr = nil); cdecl; external core_lib; overload; -function cvCreateMemStorage; external core_lib; +function cvCreateMemStorage(block_size: Integer = 0): pCvMemStorage; cdecl; external core_lib; -function cvGetSeqElem; external core_lib; +function cvGetSeqElem(const seq: pCvSeq; index: Integer): Pointer; cdecl; external core_lib; -procedure cvReleaseMemStorage; external core_lib; +procedure cvReleaseMemStorage(var storage: pCvMemStorage); cdecl; external core_lib; -procedure cvRectangle; external core_lib; +procedure cvRectangle(img: pCvArr; pt1: TCvPoint; pt2: TCvPoint; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); cdecl; external core_lib; -function cvGetRows; external core_lib; +function cvGetRows(const arr: pCvArr; submat: pCvMat; start_row, end_row: Integer; delta_row: Integer = 1): pCvMat; cdecl; external core_lib; -procedure cvFlip; external core_lib; -procedure cvMirror; external core_lib name 'cvFlip'; +procedure cvFlip(const src: pCvArr; dst: pCvArr = nil; flip_mode: Integer = 0); cdecl; external core_lib; +procedure cvMirror(const src: pCvArr; dst: pCvArr = nil; flip_mode: Integer = 0); cdecl; external core_lib name 'cvFlip'; -procedure cvClearMemStorage; external core_lib; +procedure cvClearMemStorage(storage: pCvMemStorage); cdecl; external core_lib; -procedure cvDrawContours; external core_lib; +procedure cvDrawContours(img: pIplImage; contour: pCvSeq; external_color, hole_color: TCvScalar; max_level, thickness { =1 } , line_type: Integer { =8 }; + offset: TCvPoint { =cvPoint(0,0) } ); cdecl; external core_lib; -function cvCreateChildMemStorage; external core_lib; +function cvCreateChildMemStorage(parent: pCvMemStorage): pCvMemStorage; cdecl; external core_lib; -procedure cvCvtSeqToArray; external core_lib; +procedure cvCvtSeqToArray(const seq: pCvSeq; elements: pCvArr; slice: TCvSlice { =CV_WHOLE_SEQ } ); cdecl; external core_lib; -function cvOpenFileStorage; external core_lib; +function cvOpenFileStorage(const filename: pCvChar; memstorage: pCvMemStorage; flags: Integer; const encoding: pCvChar = nil): pCvFileStorage; cdecl; external core_lib; -procedure cvReleaseFileStorage; external core_lib; +procedure cvReleaseFileStorage(var fs: pCvFileStorage); cdecl; external core_lib; -function cvGetFileNodeByName; external core_lib; +function cvGetFileNodeByName(const fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar): pCvFileNode; cdecl; external core_lib; -function cvReadInt; +function cvReadInt(const node: pCvFileNode; default_value: Integer = 0): Integer; {$IFDEF USE_INLINE} inline; {$ENDIF} begin // return !node ? default_value : // CV_NODE_IS_INT(node->tag) ? node->data.i : @@ -2729,29 +2895,32 @@ begin result := iif(not Assigned(node), default_value, iif(CV_NODE_IS_INT(node^.tag), node^.i, iif(CV_NODE_IS_REAL(node^.tag), node^.F, $7FFFFFFF))); end; -function cvReadIntByName; +function cvReadIntByName(const fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar; default_value: Integer = 0): Integer; +{$IFDEF USE_INLINE} inline; {$ENDIF} begin // return cvReadInt( cvGetFileNodeByName( fs, map, name ), default_value ); result := cvReadInt(cvGetFileNodeByName(fs, map, name), default_value); end; -function cvRead; external core_lib; +function cvRead(fs: pCvFileStorage; node: pCvFileNode; attributes: pCvAttrList = nil): pPointer; cdecl; external core_lib; -procedure cvStartReadSeq; external core_lib; +procedure cvStartReadSeq(const seq: Pointer; reader: pCvSeqReader; reverse: Integer = 0); cdecl; external core_lib; -procedure cvChangeSeqBlock; external core_lib; +procedure cvChangeSeqBlock(reader: pCvSeqReader; direction: Integer); cdecl; external core_lib; -procedure cvFillConvexPoly; external core_lib; +procedure cvFillConvexPoly(img: pCvArr; const pts: pCVPoint; npts: Integer; color: TCvScalar; line_type: Integer = 8; shift: Integer = 0); cdecl; cdecl; external core_lib; -procedure cvPolyLine; external core_lib; +procedure cvPolyLine(img: pCvArr; pts: pCVPoint; const npts: pInteger; contours: Integer; is_closed: Integer; color: TCvScalar; thickness: Integer = 1; + line_type: Integer = 8; shift: Integer = 0); cdecl; external core_lib; -function cvCreateSeq; external core_lib; +function cvCreateSeq(seq_flags: Integer; header_size: NativeUInt; elem_size: NativeUInt; storage: pCvMemStorage): pCvSeq; cdecl; external core_lib; -procedure cvCreateSeqBlock; external core_lib; +procedure cvCreateSeqBlock(writer: pCvSeqWriter); cdecl; external core_lib; -function cvSeqPush; external core_lib; +function cvSeqPush(seq: pCvSeq; const element: Pointer = nil): Pointer; cdecl; external core_lib; -procedure cvEllipseBox; +procedure cvEllipseBox(img: pCvArr; box: TCvBox2D; color: TCvScalar; thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); +{$IFDEF USE_INLINE} inline; {$ENDIF} var axes: TCvSize; begin @@ -2760,19 +2929,20 @@ begin cvEllipse(img, cvPointFrom32f(box.center), axes, box.angle, 0, 360, color, thickness, line_type, shift); end; -procedure cvOr; external core_lib; +procedure cvOr(const src1, src2: pCvArr; dst: pCvArr; const mask: pCvArr = nil); cdecl; external core_lib; -procedure cvXor; external core_lib; +procedure cvXor(const src1, src2: pCvArr; dst: pCvArr; const mask: pCvArr = nil); cdecl; external core_lib; // procedure cvXorS; external core_lib; // procedure cvXorS(const src: pIplImage; value: TCvScalar; dst: pIplImage; const mask: pCvArr = nil); cdecl; external core_lib; overload; procedure cvXorS(const src: pCvArr; value: TCvScalar; dst: pCvArr; const mask: pCvArr = nil); cdecl; external core_lib; overload; -procedure cvNot; external core_lib; +procedure cvNot(const src: pCvArr; dst: pCvArr); cdecl; external core_lib; -procedure cvEllipse; external core_lib; +procedure cvEllipse(img: pCvArr; center: TCvPoint; axes: TCvSize; angle: double; start_angle: double; nd_angle: double; color: TCvScalar; + thickness: Integer = 1; line_type: Integer = 8; shift: Integer = 0); cdecl; external core_lib; -procedure cvFree; +procedure cvFree(var ptr); {$IFDEF USE_INLINE} inline; {$ENDIF} begin // #define cvFree(ptr) (cvFree_(*(ptr)), *(ptr)=0) cvFree_(@ptr); @@ -2791,14 +2961,14 @@ begin // type_ := CV_MAT_TYPE(mat^._type); assert((i < mat^.rows) and (j < mat^.cols) and (CV_MAT_TYPE(mat^._type) = CV_32FC1)); ptr := mat^.data.ptr; - Inc(ptr, mat.step * i + sizeof(Single) * j); + Inc(ptr, mat^.step * i + sizeof(Single) * j); pf := PSingle(ptr); result := pf^; end; -procedure cvRelease(var struct_ptr: Pointer); external core_lib name 'cvRelease'; +procedure cvRelease(var struct_ptr: Pointer); cdecl; external core_lib name 'cvRelease'; -procedure cvRelease(var struct_ptr: pCvSeq); external core_lib name 'cvRelease'; +procedure cvRelease(var struct_ptr: pCvSeq); cdecl; external core_lib name 'cvRelease'; // {$IFDEF MSWINDOWS} // @@ -2821,43 +2991,43 @@ procedure cvRelease(var struct_ptr: pCvSeq); external core_lib name 'cvRelease'; // result := GetTickFrequency() * 1E-6; // end; -function cvGetTickCount; external core_lib; +function cvGetTickCount: int64; cdecl; external core_lib; -function cvGetTickFrequency; external core_lib; +function cvGetTickFrequency: double; cdecl; external core_lib; -function cvCheckHardwareSupport; external core_lib; +function cvCheckHardwareSupport(feature: Integer): Integer; cdecl; external core_lib; -function cvGetNumThreads; external core_lib; +function cvGetNumThreads: Integer; cdecl; external core_lib; -procedure cvSetNumThreads; external core_lib; +procedure cvSetNumThreads(threads: Integer = 0); cdecl; external core_lib; -function cvGetThreadNum; external core_lib; +function cvGetThreadNum: Integer; cdecl; external core_lib; -procedure cvAbsDiff; external core_lib; +procedure cvAbsDiff(const src1: pCvArr; const src2: pCvArr; dst: pCvArr); cdecl; external core_lib; -function cvNorm; external core_lib; +function cvNorm(const arr1: pCvArr; const arr2: pCvArr = nil; norm_type: Integer = CV_L2; const mask: pCvArr = nil): double; cdecl; external core_lib; -procedure cvSeqRemove; external core_lib; +procedure cvSeqRemove(seq: pCvSeq; index: Integer); cdecl; external core_lib; -procedure cvClearSeq; external core_lib; +procedure cvClearSeq(seq: pCvSeq); cdecl; external core_lib; -procedure cvWrite; external core_lib; +procedure cvWrite(fs: pCvFileStorage; const name: pCvChar; const ptr: pCvArr; attributes: TCvAttrList { = cvAttrList() } ); cdecl; external core_lib; -function cvSeqPartition; external core_lib; +function cvSeqPartition(const seq: pCvSeq; storage: pCvMemStorage; labels: pCvSeq; is_equal: TCvCmpFunc; userdata: Pointer): Integer; cdecl; external core_lib; -function cvSum; external core_lib; +function cvSum(const arr: pCvArr): TCvScalar; cdecl; external core_lib; -procedure cvRandArr; external core_lib; +procedure cvRandArr(rng: pCvRNG; arr: pCvArr; dist_type: Integer; param1: TCvScalar; param2: TCvScalar); cdecl; external core_lib; -procedure cvRandShuffle; external core_lib; +procedure cvRandShuffle(mat: pCvArr; rng: pCvRNG; iter_factor: double = 1); cdecl; external core_lib; -procedure cvWriteInt; external core_lib; +procedure cvWriteInt(fs: pCvFileStorage; const name: pCvChar; value: Integer); cdecl; external core_lib; -procedure cvWriteReal; external core_lib; +procedure cvWriteReal(fs: pCvFileStorage; const name: pCvChar; value: double); cdecl; external core_lib; -procedure cvWriteString; external core_lib; +procedure cvWriteString(fs: pCvFileStorage; const name: pCvChar; const str: pCvChar; quote: Integer = 0); cdecl; external core_lib; -procedure cvWriteComment; external core_lib; +procedure cvWriteComment(fs: pCvFileStorage; const comment: pCvChar; eol_comment: Integer); cdecl; external core_lib; function cvReadByName(fs: pCvFileStorage; const map: pCvFileNode; const name: pCvChar; attributes: pCvAttrList = nil): Pointer; begin @@ -2884,311 +3054,331 @@ begin result := default_value; end; -function cvGetErrStatus; external core_lib; +function cvGetErrStatus: Integer; cdecl; external core_lib; -procedure cvSetErrStatus; external core_lib; +procedure cvSetErrStatus(status: Integer); cdecl; external core_lib; -function cvGetErrMode; external core_lib; +function cvGetErrMode: Integer; cdecl; external core_lib; -function cvSetErrMode; external core_lib; +function cvSetErrMode(mode: Integer): Integer; cdecl; external core_lib; -procedure cvError; external core_lib; +procedure cvError(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar = nil; line: Integer = 0); cdecl; external core_lib; -procedure cvDFT; external core_lib; +procedure cvDFT(const src: pCvArr; dst: pCvArr; flags: Integer; nonzero_rows: Integer = 0); cdecl; external core_lib; -procedure cvFFT; external core_lib name 'cvDFT'; +procedure cvFFT(const src: pCvArr; dst: pCvArr; flags: Integer; nonzero_rows: Integer = 0); cdecl; external core_lib name 'cvDFT'; -procedure cvMulSpectrums; external core_lib; +procedure cvMulSpectrums(const src1: pCvArr; const src2: pCvArr; dst: pCvArr; flags: Integer); cdecl; external core_lib; -function cvGetOptimalDFTSize; external core_lib; +function cvGetOptimalDFTSize(size0: Integer): Integer; cdecl; external core_lib; -procedure cvDCT; external core_lib; +procedure cvDCT(const src: pCvArr; dst: pCvArr; flags: Integer); cdecl; external core_lib; -procedure cvCartToPolar; external core_lib; +procedure cvCartToPolar(const x: pCvArr; const y: pCvArr; magnitude: pCvArr; angle: pCvArr = nil; angle_in_degrees: Integer = 0); cdecl; external core_lib; -procedure cvPolarToCart; external core_lib; +procedure cvPolarToCart(const magnitude: pCvArr; const angle: pCvArr; x: pCvArr; y: pCvArr; angle_in_degrees: Integer = 0); cdecl; external core_lib; -procedure cvPow; external core_lib; +procedure cvPow(const src: pCvArr; dst: pCvArr; power: double); cdecl; external core_lib; -procedure cvExp; external core_lib; +procedure cvExp(const src: pCvArr; dst: pCvArr); cdecl; external core_lib; -procedure cvLog; external core_lib; +procedure cvLog(const src: pCvArr; dst: pCvArr); cdecl; external core_lib; -procedure cvCrossProduct; external core_lib; +procedure cvCrossProduct(const src1: pCvArr; const src2: pCvArr; dst: pCvArr); cdecl; external core_lib; procedure cvMatMulAdd(const src1, src2, src3: pCvArr; dst: pCvArr); begin cvGEMM(src1, src2, 1, src3, 1, dst, 0); end; -procedure cvGEMM; external core_lib; -procedure cvMatMulAddEx; external core_lib name 'cvGEMM'; +procedure cvGEMM(const src1: pCvArr; const src2: pCvArr; alpha: double; const src3: pCvArr; beta: double; dst: pCvArr; tABC: Integer = 0); cdecl; external core_lib; +procedure cvMatMulAddEx(const src1: pCvArr; const src2: pCvArr; alpha: double; const src3: pCvArr; beta: double; dst: pCvArr; tABC: Integer = 0); cdecl; external core_lib name 'cvGEMM'; -function cvInvert; external core_lib; +function cvInvert(const src: pCvArr; dst: pCvArr; method: Integer = CV_LU): double; cdecl; external core_lib; -function cvFastArctan; external core_lib; +function cvFastArctan(y, x: Float): Float; cdecl; external core_lib; -function cvCbrt; external core_lib; +function cvCbrt(value: Float): Float; cdecl; external core_lib; -function cvCheckArr; external core_lib; +function cvCheckArr(const arr: pCvArr; flags: Integer = 0; min_val: double = 0; max_val: double = 0): Integer; cdecl; external core_lib; -procedure cvGetTextSize; external core_lib; +procedure cvGetTextSize(const text_string: pCvChar; const font: pCvFont; text_size: pCvSize; var baseline: Integer); cdecl; external core_lib; -procedure cvInitTreeNodeIterator; external core_lib; +procedure cvInitTreeNodeIterator(var tree_iterator: TCvTreeNodeIterator; const first: Pointer; max_level: Integer); cdecl; external core_lib; -function cvNextTreeNode; external core_lib; +function cvNextTreeNode(tree_iterator: pCvTreeNodeIterator): Pointer; cdecl; external core_lib; -function cvPrevTreeNode; external core_lib; +function cvPrevTreeNode(tree_iterator: pCvTreeNodeIterator): Pointer; cdecl; external core_lib; -procedure cvInsertNodeIntoTree; external core_lib; +procedure cvInsertNodeIntoTree(node: Pointer; parent: Pointer; frame: Pointer); cdecl; external core_lib; -procedure cvRemoveNodeFromTree; external core_lib; +procedure cvRemoveNodeFromTree(node: Pointer; frame: Pointer); cdecl; external core_lib; -function cvTreeToNodeSeq; external core_lib; +function cvTreeToNodeSeq(const first: Pointer; header_size: Integer; storage: pCvMemStorage): pCvSeq; cdecl; external core_lib; -function cvKMeans2; external core_lib; +function cvKMeans2(const samples: pCvArr; cluster_count: Integer; labels: pCvArr; termcrit: TCvTermCriteria; attempts: Integer = 1; rng: pCvRNG = nil; + flags: Integer = 0; _centers: pCvArr = nil; compactness: pDouble = nil): Integer; cdecl; external core_lib; -procedure cvAndS; external core_lib; +procedure cvAndS(const src: pCvArr; value: TCvScalar; dst: pCvArr; const mask: pCvArr = nil); cdecl; external core_lib; -procedure cvOrS; external core_lib; +procedure cvOrS(const src: pCvArr; value: TCvScalar; dst: pCvArr; const mask: pCvArr = nil); cdecl; external core_lib; -procedure cvCmp; external core_lib; +procedure cvCmp(const src1, src2: pCvArr; dst: pCvArr; cmp_op: integer); cdecl; external core_lib; -procedure cvCmpS; external core_lib; +procedure cvCmpS(const src: pCvArr; value: double; dst: pCvArr; cmp_op: integer); cdecl; external core_lib; -procedure cvMin; external core_lib; +procedure cvMin(const src1, src2:pCvArr; dst:pCvArr); cdecl; external core_lib; -procedure cvMax; external core_lib; +procedure cvMax(const src1, src2:pCvArr; dst:pCvArr); cdecl; external core_lib; -procedure cvMinS; external core_lib; +procedure cvMinS(const src:pCvArr; value:double; dst:pCvArr); cdecl; external core_lib; -procedure cvMaxS; external core_lib; +procedure cvMaxS(const src:pCvArr; value:double; dst:pCvArr); cdecl; external core_lib; -procedure cvAbsDiffS; external core_lib; +procedure cvAbsDiffS(const src: pCvArr; dst: pCvArr; value:TCvScalar); cdecl; external core_lib; -procedure cvSort; external core_lib; +procedure cvSort(const src:pCvArr; dst : pCvArr = nil; + idxmat :pCvArr=nil; + flags : integer =0); cdecl; external core_lib; -function cvSolveCubic; external core_lib; +function cvSolveCubic(const coeffs: pCvMat; roots: pCvMat): Integer; cdecl; external core_lib; -procedure cvSolvePoly; external core_lib; +procedure cvSolvePoly(const coeffs: pCvMat; roots2: pCvMat; maxiter: Integer = 20; fig: Integer = 100); cdecl; external core_lib; -procedure cvTransform; external core_lib; -procedure cvMatMulAddS; external core_lib name 'cvTransform'; +procedure cvTransform(const src: pCvArr; dst: pCvArr; const transmat: pCvMat; const shiftvec: pCvMat = nil); cdecl; external core_lib; +procedure cvMatMulAddS(const src: pCvArr; dst: pCvArr; const transmat: pCvMat; const shiftvec: pCvMat = nil); cdecl; external core_lib name 'cvTransform'; -procedure cvPerspectiveTransform; external core_lib; +procedure cvPerspectiveTransform(const src: pCvArr; dst: pCvArr; const mat: pCvMat); cdecl; external core_lib; -procedure cvMulTransposed; external core_lib; +procedure cvMulTransposed(const src: pCvArr; dst: pCvArr; order: Integer; const delta: pCvArr = nil; scale: double = 1); cdecl; external core_lib; -procedure cvTranspose; external core_lib; -procedure cvT; external core_lib name 'cvTranspose'; +procedure cvTranspose(const src: pCvArr; dst: pCvArr); cdecl; external core_lib; +procedure cvT(const src: pCvArr; dst: pCvArr); cdecl; external core_lib name 'cvTranspose'; -procedure cvCompleteSymm; external core_lib; +procedure cvCompleteSymm(matrix: pCvMat; LtoR: Integer = 0); cdecl; external core_lib; -procedure cvSVD; external core_lib; +procedure cvSVD(A: pCvArr; W: pCvArr; U: pCvArr = nil; V: pCvArr = nil; flags: Integer = 0); cdecl; external core_lib; -procedure cvSVBkSb; external core_lib; +procedure cvSVBkSb(const W: pCvArr; const U: pCvArr; const V: pCvArr; const B: pCvArr; x: pCvArr; flags: Integer); cdecl; external core_lib; -function cvSolve; external core_lib; +function cvSolve(const src1: pCvArr; const src2: pCvArr; dst: pCvArr; method: Integer = CV_LU): Integer; cdecl; external core_lib; -function cvDet; external core_lib; +function cvDet(const mat: pCvArr): double; cdecl; external core_lib; -function cvTrace; external core_lib; +function cvTrace(const mat: pCvArr): TCvScalar; cdecl; external core_lib; -procedure cvEigenVV; external core_lib; +procedure cvEigenVV(mat: pCvArr; evects: pCvArr; evals: pCvArr; eps: double = 0; lowindex: Integer = -1; highindex: Integer = -1); cdecl; external core_lib; -procedure cvSetIdentity; external core_lib; +procedure cvSetIdentity(mat: pCvArr; value: TCvScalar { =cvRealScalar(1) } ); cdecl; external core_lib; -function cvRange; external core_lib; +function cvRange(mat: pCvArr; start: double; end_: double): pCvArr; cdecl; external core_lib; -procedure cvCalcCovarMatrix; external core_lib; +procedure cvCalcCovarMatrix(const vects: pCvArrArray; count: Integer; cov_mat: pCvArr; avg: pCvArr; flags: Integer); cdecl; external core_lib; -procedure cvCalcPCA; external core_lib; +procedure cvCalcPCA(const data: pCvArr; mean: pCvArr; eigenvals: pCvArr; eigenvects: pCvArr; flags: Integer); cdecl; external core_lib; -procedure cvProjectPCA; external core_lib; +procedure cvProjectPCA(const data: pCvArr; const mean: pCvArr; const eigenvects: pCvArr; result: pCvArr); cdecl; external core_lib; -procedure cvBackProjectPCA; external core_lib; +procedure cvBackProjectPCA(const proj: pCvArr; const mean: pCvArr; const eigenvects: pCvArr; result: pCvArr); cdecl; external core_lib; -function cvMahalanobis; external core_lib; +function cvMahalanobis(const vec1: pCvArr; const vec2: pCvArr; const mat: pCvArr): double; cdecl; external core_lib; -function cvAvg; external core_lib; +function cvAvg(const arr: pCvArr; const mask: pCvArr = nil): TCvScalar; cdecl; external core_lib; -procedure cvAvgSdv; external core_lib; +procedure cvAvgSdv(const arr: pCvArr; mean: pCvScalar; std_dev: pCvScalar; const mask: pCvArr = nil); cdecl; external core_lib; -procedure cvNormalize; external core_lib; +procedure cvNormalize(const src: pCvArr; dst: pCvArr; A: double { = CV_DEFAULT(1) }; B: double { =CV_DEFAULT(0.) }; norm_type: Integer { =CV_DEFAULT(CV_L2) }; + const mask: pCvArr = nil); cdecl; external core_lib; -procedure cvReduce; external core_lib; +procedure cvReduce(const src: pCvArr; dst: pCvArr; dim: Integer = -1; op: Integer = CV_REDUCE_SUM); cdecl; external core_lib; -function cvSliceLength; external core_lib; +function cvSliceLength(slice: TCvSlice; const seq: pCvSeq): Integer; cdecl; external core_lib; -procedure cvSaveMemStoragePos; external core_lib; +procedure cvSaveMemStoragePos(const storage:pCvMemStorage; pos:pCvMemStoragePos); cdecl; external core_lib; -procedure cvRestoreMemStoragePos; external core_lib; +procedure cvRestoreMemStoragePos(storage:pCvMemStorage; pos:pCvMemStoragePos); cdecl; external core_lib; -function cvMemStorageAlloc; external core_lib; +function cvMemStorageAlloc(storage: pCvMemStorage; size: size_t): Pointer; cdecl; external core_lib; -function cvMemStorageAllocString; external core_lib; +function cvMemStorageAllocString(storage: pCvMemStorage; const ptr: pCvChar; len: Integer = -1): TCvString; cdecl; external core_lib; -procedure cvSetSeqBlockSize; external core_lib; +procedure cvSetSeqBlockSize( seq:pCvSeq; delta_elems:Integer ); cdecl; external core_lib; -function cvSeqPushFront; external core_lib; +function cvSeqPushFront(seq: pCvSeq; const element: Pointer = nil): pschar; cdecl; external core_lib; -procedure cvSeqPop; external core_lib; +procedure cvSeqPop(seq:pCvSeq; element : pointer = nil);cdecl; external core_lib; -procedure cvSeqPopFront; external core_lib; +procedure cvSeqPopFront(seq:pCvSeq; element :pointer = nil); cdecl; external core_lib; -procedure cvSeqPushMulti; external core_lib; +procedure cvSeqPushMulti(seq:pCvSeq; const elements:pointer; count:Integer; in_front:integer = 0); cdecl; external core_lib; -procedure cvSeqPopMulti; external core_lib; +procedure cvSeqPopMulti(seq:pCvSeq; elements:pointer; count:integer; in_front:integer=0); cdecl; external core_lib; -function cvSeqInsert; external core_lib; +function cvSeqInsert(seq: pCvSeq; before_index: Integer; const element: Pointer = nil): pschar; cdecl; external core_lib; -function cvSeqElemIdx; external core_lib; +function cvSeqElemIdx(const seq: pCvSeq; const element: Pointer; block: pCvSeqBlockArray = nil): Integer; cdecl; external core_lib; -procedure cvStartAppendToSeq; external core_lib; +procedure cvStartAppendToSeq(seq:pCvSeq; writer:pCvSeqWriter); cdecl; external core_lib; -procedure cvStartWriteSeq; external core_lib; +procedure cvStartWriteSeq( seq_flags:integer; header_size:Integer; + elem_size:Integer; storage:pCvMemStorage; + writer:pCvSeqWriter); cdecl; external core_lib; -function cvEndWriteSeq; external core_lib; +function cvEndWriteSeq(writer: pCvSeqWriter): pCvSeq; cdecl; external core_lib; -procedure cvFlushSeqWriter; external core_lib; +procedure cvFlushSeqWriter( writer:pCvSeqWriter ); cdecl; external core_lib; -function cvGetSeqReaderPos; external core_lib; +function cvGetSeqReaderPos(reader: pCvSeqReader): Integer; cdecl; external core_lib; -procedure cvSetSeqReaderPos; external core_lib; +procedure cvSetSeqReaderPos(reader:pCvSeqReader; index:Integer; is_relative :Integer = 0); cdecl; external core_lib; -function cvMakeSeqHeaderForArray; external core_lib; +function cvMakeSeqHeaderForArray(seq_type: Integer; header_size: Integer; elem_size: Integer; elements: Pointer; total: Integer; seq: pCvSeq; + block: pCvSeqBlock): pCvSeq; cdecl; external core_lib; -function cvSeqSlice; external core_lib; +function cvSeqSlice(const seq: pCvSeq; slice: TCvSlice; storage: pCvMemStorage = nil; copy_data: Integer = 0): pCvSeq; cdecl; external core_lib; -procedure cvSeqRemoveSlice; external core_lib; +procedure cvSeqRemoveSlice( seq:pCvSeq; slice :TCvSlice); cdecl; external core_lib; -procedure cvSeqInsertSlice; external core_lib; +procedure cvSeqInsertSlice(seq:pCvSeq; before_index:integer; const from_arr:pCvArr);cdecl; external core_lib; -procedure cvSeqSort; external core_lib; +procedure cvSeqSort(seq:pCvSeq; func:TCvCmpFunc; userdata:pointer = nil); cdecl; external core_lib; -function cvSeqSearch; external core_lib; +function cvSeqSearch(seq: pCvSeq; const elem: Pointer; func: TCvCmpFunc; is_sorted: Integer; elem_idx: pInteger; userdata: Pointer = nil): pschar; cdecl; external core_lib; -procedure cvSeqInvert; external core_lib; +procedure cvSeqInvert( seq:pCvSeq );cdecl; external core_lib; -function cvCreateSet; external core_lib; +function cvCreateSet(set_flags: Integer; header_size: Integer; elem_size: Integer; storage: pCvMemStorage): pCvSet; cdecl; external core_lib; -function cvSetAdd; external core_lib; +function cvSetAdd(set_header: pCvSet; elem: pCvSetElem = nil; inserted_elem: pCvSetElemArray = nil): Integer; cdecl; external core_lib; -procedure cvSetRemove; external core_lib; +procedure cvSetRemove(set_header:pCvSet; index:Integer );cdecl; external core_lib; -procedure cvClearSet; external core_lib; +procedure cvClearSet( set_header:pCvSet ); cdecl; external core_lib; -function cvCreateGraph; external core_lib; +function cvCreateGraph(graph_flags: Integer; header_size: Integer; vtx_size: Integer; edge_size: Integer; storage: pCvMemStorage): pCvGraph; cdecl; external core_lib; -function cvGraphAddVtx; external core_lib; +function cvGraphAddVtx(graph: pCvGraph; const vtx: pCvGraphVtx = nil; inserted_vtx: pCvGraphVtxArray = nil): Integer; cdecl; external core_lib; -function cvGraphRemoveVtx; external core_lib; +function cvGraphRemoveVtx(graph: pCvGraph; index: Integer): Integer; cdecl; external core_lib; -function cvGraphRemoveVtxByPtr; external core_lib; +function cvGraphRemoveVtxByPtr(graph: pCvGraph; vtx: pCvGraphVtx): Integer; cdecl; external core_lib; -function cvGraphAddEdge; external core_lib; +function cvGraphAddEdge(graph: pCvGraph; start_idx: Integer; end_idx: Integer; const edge: pCvGraphEdge = nil; inserted_edge: pCvGraphEdgeArray = nil) + : Integer; cdecl; external core_lib; -function cvGraphAddEdgeByPtr; external core_lib; +function cvGraphAddEdgeByPtr(graph: pCvGraph; start_vtx: pCvGraphVtx; end_vtx: pCvGraphVtx; const edge: pCvGraphEdge = nil; + inserted_edge: pCvGraphEdgeArray = nil): Integer; cdecl; external core_lib; -procedure cvGraphRemoveEdge; external core_lib; +procedure cvGraphRemoveEdge(graph: pCvGraph; start_idx: Integer; end_idx: Integer); cdecl; external core_lib; -procedure cvGraphRemoveEdgeByPtr; external core_lib; +procedure cvGraphRemoveEdgeByPtr(graph: pCvGraph; start_vtx: pCvGraphVtx; end_vtx: pCvGraphVtx); cdecl; external core_lib; -function cvFindGraphEdge; external core_lib; +function cvFindGraphEdge(const graph: pCvGraph; start_idx: Integer; end_idx: Integer): pCvGraphEdge; cdecl; external core_lib; -function cvFindGraphEdgeByPtr; external core_lib; +function cvFindGraphEdgeByPtr(const graph: pCvGraph; const start_vtx: pCvGraphVtx; const end_vtx: pCvGraphVtx): pCvGraphEdge; cdecl; external core_lib; -procedure cvClearGraph; external core_lib; +procedure cvClearGraph(graph: pCvGraph); cdecl; external core_lib; -function cvGraphVtxDegree; external core_lib; +function cvGraphVtxDegree(const graph: pCvGraph; vtx_idx: Integer): Integer; cdecl; external core_lib; -function cvGraphVtxDegreeByPtr; external core_lib; +function cvGraphVtxDegreeByPtr(const graph: pCvGraph; const vtx: pCvGraphVtx): Integer; cdecl; external core_lib; -function cvCreateGraphScanner; external core_lib; +function cvCreateGraphScanner(graph: pCvGraph; vtx: pCvGraphVtx = nil; mask: Integer = CV_GRAPH_ALL_ITEMS): pCvGraphScanner; cdecl; external core_lib; -procedure cvReleaseGraphScanner; external core_lib; +procedure cvReleaseGraphScanner(var scanner: pCvGraphScanner); cdecl; external core_lib; -function cvNextGraphItem; external core_lib; +function cvNextGraphItem(scanner: pCvGraphScanner): Integer; cdecl; external core_lib; -function cvCloneGraph; external core_lib; +function cvCloneGraph(const graph: pCvGraph; storage: pCvMemStorage): pCvGraph; cdecl; external core_lib; -procedure cvRectangleR; external core_lib; +procedure cvRectangleR( img:pCvArr; r:TCvRect; color:TCvScalar; thickness:integer=1; + line_type :integer =8; + shift:integer=0); cdecl; external core_lib; -procedure cvFillPoly; external core_lib; +procedure cvFillPoly( img:pCvArr; pts:pCvPointArray; const npts:pInteger; + contours:Integer; color:TCvScalar; + line_type :Integer=8; shift :Integer=0 ); cdecl; external core_lib; -function cvClipLine; external core_lib; +function cvClipLine(img_size: TCvSize; pt1: pCVPoint; pt2: pCVPoint): Integer; cdecl; external core_lib; -function cvInitLineIterator; external core_lib; +function cvInitLineIterator(const image: pCvArr; pt1: TCvPoint; pt2: TCvPoint; line_iterator: pCvLineIterator; connectivity: Integer = 8; + left_to_right: Integer = 0): Integer; cdecl; external core_lib; -function cvColorToScalar; external core_lib; +function cvColorToScalar(packed_color: double; arrtype: Integer): TCvScalar; cdecl; external core_lib; -function cvEllipse2Poly; external core_lib; +function cvEllipse2Poly(center: TCvPoint; axes: TCvSize; angle: Integer; arc_start: Integer; arc_end: Integer; pts: pCVPoint; delta: Integer): Integer; cdecl; external core_lib; -procedure cvLUT; external core_lib; +procedure cvLUT(const src: pCvArr; dst: pCvArr; const lut: pCvArr); cdecl; external core_lib; -function cvRegisterModule; external core_lib; +function cvRegisterModule(const module_info: pCvModuleInfo): Integer; cdecl; external core_lib; -function cvUseOptimized; external core_lib; +function cvUseOptimized(on_off: Integer): Integer; cdecl; external core_lib; -procedure cvGetModuleInfo; external core_lib; +procedure cvGetModuleInfo(const module_name: pCvChar; const version: ppCvChar; const loaded_addon_plugins: ppCvChar); cdecl; external core_lib; -procedure cvSetMemoryManager; external core_lib; +procedure cvSetMemoryManager(alloc_func: TCvAllocFunc = nil; free_func: TCvFreeFunc = nil; userdata: Pointer = nil); cdecl; external core_lib; -procedure cvSetIPLAllocators; external core_lib; +procedure cvSetIPLAllocators(create_header: TCv_iplCreateImageHeader; allocate_data: TCv_iplAllocateImageData; deallocate: TCv_iplDeallocate; + create_roi: TCv_iplCreateROI; clone_image: TCv_iplCloneImage); cdecl; external core_lib; -function cvAttrValue; external core_lib; +function cvAttrValue(const attr: pCvAttrList; const attr_name: pCvChar): pCvChar; cdecl; external core_lib; -procedure cvStartWriteStruct; external core_lib; +procedure cvStartWriteStruct( fs:pCvFileStorage; const name:pCVChar; + struct_flags:Integer; const type_name :pCVChar; + attributes:TCvAttrList); cdecl; external core_lib; -procedure cvEndWriteStruct; external core_lib; +procedure cvEndWriteStruct(fs:pCvFileStorage );cdecl; external core_lib; -procedure cvStartNextStream; external core_lib; +procedure cvStartNextStream(fs: pCvFileStorage); cdecl; external core_lib; -procedure cvWriteRawData; external core_lib; +procedure cvWriteRawData(fs: pCvFileStorage; const src: Pointer; len: Integer; const dt: pCvChar); cdecl; external core_lib; -function cvGetHashedKey; external core_lib; +function cvGetHashedKey(fs: pCvFileStorage; const name: pCvChar; len: Integer = -1; create_missing: Integer = 0): pCvStringHashNode; cdecl; external core_lib; -function cvGetRootFileNode; external core_lib; +function cvGetRootFileNode(const fs: pCvFileStorage; stream_index: Integer = 0): pCvFileNode; cdecl; external core_lib; -function cvGetFileNode; external core_lib; +function cvGetFileNode(fs: pCvFileStorage; map: pCvFileNode; const key: pCvStringHashNode; create_missing: Integer = 0): pCvFileNode; cdecl; external core_lib; -procedure cvStartReadRawData; external core_lib; +procedure cvStartReadRawData(const fs: pCvFileStorage; const src: pCvFileNode; reader: pCvSeqReader); cdecl; external core_lib; -procedure cvReadRawDataSlice; external core_lib; +procedure cvReadRawDataSlice(const fs: pCvFileStorage; reader: pCvSeqReader; count: Integer; dst: Pointer; const dt: pCvChar); cdecl; external core_lib; -procedure cvReadRawData; external core_lib; +procedure cvReadRawData(const fs: pCvFileStorage; const src: pCvFileNode; dst: Pointer; const dt: pCvChar); cdecl; external core_lib; -procedure cvWriteFileNode; external core_lib; +procedure cvWriteFileNode(fs: pCvFileStorage; const new_node_name: pCvChar; const node: pCvFileNode; embed: Integer); cdecl; external core_lib; -function cvGetFileNodeName; external core_lib; +function cvGetFileNodeName(const node: pCvFileNode): pCvChar; cdecl; external core_lib; -procedure cvRegisterType; external core_lib; +procedure cvRegisterType(const info: pCvTypeInfo); cdecl; external core_lib; -procedure cvUnregisterType; external core_lib; +procedure cvUnregisterType(const type_name: pCvChar); cdecl; external core_lib; -function cvFirstType; external core_lib; +function cvFirstType: pCvTypeInfo; cdecl; external core_lib; -function cvFindType; external core_lib; +function cvFindType(const type_name: pCvChar): pCvTypeInfo; cdecl; external core_lib; -function cvTypeOf; external core_lib; +function cvTypeOf(const struct_ptr: Pointer): pCvTypeInfo; cdecl; external core_lib; -function cvClone; external core_lib; +function cvClone(const struct_ptr: Pointer): Pointer; cdecl; external core_lib; -function cvErrorStr; external core_lib; +function cvErrorStr(status: Integer): pCvChar; cdecl; external core_lib; -function cvGetErrInfo; external core_lib; +function cvGetErrInfo(const errcode_desc: ppCvChar; const description: ppCvChar; const filename: ppCvChar; line: pInteger): Integer; cdecl; external core_lib; -function cvErrorFromIppStatus; external core_lib; +function cvErrorFromIppStatus(ipp_status: Integer): Integer; cdecl; external core_lib; -function cvRedirectError; external core_lib; +function cvRedirectError(error_handler: TCvErrorCallback; userdata: Pointer = nil; prev_userdata: ppvoid = nil): TCvErrorCallback; cdecl; external core_lib; -function cvNulDevReport; external core_lib; +function cvNulDevReport(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar; line: Integer; userdata: Pointer) + : Integer; cdecl; external core_lib; -function cvStdErrReport; external core_lib; +function cvStdErrReport(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar; line: Integer; userdata: Pointer) + : Integer; cdecl; external core_lib; -function cvGuiBoxReport; external core_lib; +function cvGuiBoxReport(status: Integer; const func_name: pCvChar; const err_msg: pCvChar; const file_name: pCvChar; line: Integer; userdata: Pointer) + : Integer; cdecl; external core_lib; -procedure cvDecRefData(arr: pCvArr); inline; +procedure cvDecRefData(arr: pCvArr); {$IFDEF USE_INLINE}inline;{$ENDIF} Var mat: pCvMat; matND: pCvMatND; @@ -3261,7 +3451,7 @@ begin end; end; -procedure cvCvtPixToPlane; external core_lib name 'cvSplit'; -procedure cvCvtPlaneToPix; external core_lib name 'cvMerge'; +procedure cvCvtPixToPlane(const src: pCvArr; dst0: pCvArr; dst1: pCvArr; dst2: pCvArr; dst3: pCvArr); cdecl; external core_lib name 'cvSplit'; +procedure cvCvtPlaneToPix(const src0: pCvArr; const src1: pCvArr; const src2: pCvArr; const src3: pCvArr; dst: pCvArr); cdecl; external core_lib name 'cvMerge'; end. diff --git a/source/ocv.editor.pas b/source/ocv.editor.pas index 8ef8231..b56adf7 100644 --- a/source/ocv.editor.pas +++ b/source/ocv.editor.pas @@ -23,10 +23,11 @@ ******************************************************************* *) -{$I OpenCV.inc} unit ocv.editor; +{$I OpenCV.inc} + interface Uses @@ -99,7 +100,7 @@ procedure Clarity(const step: Integer; const InputImage: pIplImage; Var OutputIm implementation Uses - System.Math, + Math, ocv.core_c, ocv.imgproc_c, ocv.imgproc.types_c; diff --git a/source/ocv.highgui_c.pas b/source/ocv.highgui_c.pas index 2f38da5..7996bd1 100644 --- a/source/ocv.highgui_c.pas +++ b/source/ocv.highgui_c.pas @@ -61,14 +61,14 @@ uses (* For font *) const - CV_FONT_LIGHT = 25; // QFont::Light; - CV_FONT_NORMAL = 50; // QFont::Normal; + CV_FONT_LIGHT = 25; // QFont::Light; + CV_FONT_NORMAL = 50; // QFont::Normal; CV_FONT_DEMIBOLD = 63; // QFont::DemiBold; - CV_FONT_BOLD = 75; // QFont::Bold; - CV_FONT_BLACK = 87; // QFont::Black; - CV_STYLE_NORMAL = 0; // QFont::StyleNormal; - CV_STYLE_ITALIC = 1; // QFont::StyleItalic; - CV_STYLE_OBLIQUE = 2; // QFont::StyleOblique; + CV_FONT_BOLD = 75; // QFont::Bold; + CV_FONT_BLACK = 87; // QFont::Black; + CV_STYLE_NORMAL = 0; // QFont::StyleNormal; + CV_STYLE_ITALIC = 1; // QFont::StyleItalic; + CV_STYLE_OBLIQUE = 2; // QFont::StyleOblique; // for color cvScalar(blue_component, green_component, red\_component[, alpha_component]) // and alpha= 0 <-> 0xFF (not transparent <-> transparent) @@ -156,12 +156,12 @@ Var {$ENDIF} Type - (* int (*pt2Func)(int argc, char *argv[]) *) + (* int ( *pt2Func)(int argc, char *argv[]) *) TArgvArray = array [0 .. 0] of pCvChar; pArgvArray = ^TArgvArray; Tpt2Func = function(argc: Integer; argv: pArgvArray): Integer; cdecl; (* - CVAPI(int) cvStartLoop(int (*pt2Func)(int argc, char *argv[]), int argc, char* argv[]); + CVAPI(int) cvStartLoop(int ( *pt2Func)(int argc, char *argv[]), int argc, char* argv[]); *) {$IFDEF SAFELOADLIB} @@ -194,8 +194,8 @@ Type const (* enum {CV_PUSH_BUTTON = 0, CV_CHECKBOX = 1, CV_RADIOBOX = 2}; *) CV_PUSH_BUTTON = 0; - CV_CHECKBOX = 1; - CV_RADIOBOX = 2; + CV_CHECKBOX = 1; + CV_RADIOBOX = 2; (* CVAPI(int) cvCreateButton( const char* button_name CV_DEFAULT(NULL),CvButtonCallback on_change CV_DEFAULT(NULL), void* userdata CV_DEFAULT(NULL) , int button_type CV_DEFAULT(CV_PUSH_BUTTON), int initial_button_state CV_DEFAULT(0)); *) @@ -240,10 +240,10 @@ function cvStartWindowThread: Integer; cdecl; // --------- YV --------- // These 3 flags are used by cvSet/GetWindowProperty; const - CV_WND_PROP_FULLSCREEN = 0; // to change/get window's fullscreen property - CV_WND_PROP_AUTOSIZE = 1; // to change/get window's autosize property + CV_WND_PROP_FULLSCREEN = 0; // to change/get window's fullscreen property + CV_WND_PROP_AUTOSIZE = 1; // to change/get window's autosize property CV_WND_PROP_ASPECTRATIO = 2; // to change/get window's aspectratio property - CV_WND_PROP_OPENGL = 3; // to change/get window's opengl support + CV_WND_PROP_OPENGL = 3; // to change/get window's opengl support // These 2 flags are used by cvNamedWindow and cvSet/GetWindowProperty; CV_WINDOW_NORMAL = $00000000; // the user can resize the window (no raint) / also use to switch a fullscreen window to a normal size @@ -252,11 +252,11 @@ const CV_WINDOW_OPENGL = $00001000; // window with opengl support // Those flags are only for Qt; CV_GUI_EXPANDED = $00000000; // status bar and tool bar - CV_GUI_NORMAL = $00000010; // old fashious way + CV_GUI_NORMAL = $00000010; // old fashious way // These 3 flags are used by cvNamedWindow and cvSet/GetWindowProperty; - CV_WINDOW_FULLSCREEN = 1; // change the window to fullscreen - CV_WINDOW_FREERATIO = $00000100; // the image expends as much as it can (no ratio raint) - CV_WINDOW_KEEPRATIO = $00000000; // the ration image is respected.; + CV_WINDOW_FULLSCREEN = 1; // change the window to fullscreen + CV_WINDOW_FREERATIO = $00000100; // the image expends as much as it can (no ratio raint) + CV_WINDOW_KEEPRATIO = $00000000; // the ration image is respected.; (* create window *) type @@ -384,8 +384,8 @@ type (* create trackbar and display it on top of given window, set callback *) type - TcvCreateTrackbar = function(const trackbar_name: pCvChar; const window_name: pCvChar; value: PInteger; count: Integer; - on_change: TCvTrackbarCallback): Integer; cdecl; + TcvCreateTrackbar = function(const trackbar_name: pCvChar; const window_name: pCvChar; value: PInteger; count: Integer; on_change: TCvTrackbarCallback) + : Integer; cdecl; {$IFDEF SAFELOADLIB} var @@ -404,8 +404,8 @@ type {$IFDEF SAFELOADLIB} type - TcvCreateTrackbar2 = function(const trackbar_name: pCvChar; const window_name: pCvChar; value: PInteger; count: Integer; - on_change: TCvTrackbarCallback2; userdata: Pointer = nil): Integer; cdecl; + TcvCreateTrackbar2 = function(const trackbar_name: pCvChar; const window_name: pCvChar; value: PInteger; count: Integer; on_change: TCvTrackbarCallback2; + userdata: Pointer = nil): Integer; cdecl; var cvCreateTrackbar2: TcvCreateTrackbar2; @@ -438,22 +438,22 @@ procedure cvSetTrackbarPos(const trackbar_name: pCvChar; const window_name: pCvC {$ENDIF} const - CV_EVENT_MOUSEMOVE = 0; - CV_EVENT_LBUTTONDOWN = 1; - CV_EVENT_RBUTTONDOWN = 2; - CV_EVENT_MBUTTONDOWN = 3; - CV_EVENT_LBUTTONUP = 4; - CV_EVENT_RBUTTONUP = 5; - CV_EVENT_MBUTTONUP = 6; + CV_EVENT_MOUSEMOVE = 0; + CV_EVENT_LBUTTONDOWN = 1; + CV_EVENT_RBUTTONDOWN = 2; + CV_EVENT_MBUTTONDOWN = 3; + CV_EVENT_LBUTTONUP = 4; + CV_EVENT_RBUTTONUP = 5; + CV_EVENT_MBUTTONUP = 6; CV_EVENT_LBUTTONDBLCLK = 7; CV_EVENT_RBUTTONDBLCLK = 8; CV_EVENT_MBUTTONDBLCLK = 9; - CV_EVENT_FLAG_LBUTTON = 1; - CV_EVENT_FLAG_RBUTTON = 2; - CV_EVENT_FLAG_MBUTTON = 4; - CV_EVENT_FLAG_CTRLKEY = 8; + CV_EVENT_FLAG_LBUTTON = 1; + CV_EVENT_FLAG_RBUTTON = 2; + CV_EVENT_FLAG_MBUTTON = 4; + CV_EVENT_FLAG_CTRLKEY = 8; CV_EVENT_FLAG_SHIFTKEY = 16; - CV_EVENT_FLAG_ALTKEY = 32; + CV_EVENT_FLAG_ALTKEY = 32; // type // CvMouseCallback = procedure(event: Integer; x: Integer; y: Integer; flags: Integer; param: Pointer); cdecl; @@ -522,15 +522,15 @@ function cvLoadImageM(const filename: pCvChar; iscolor: Integer = CV_LOAD_IMAGE_ {$ENDIF} const - CV_IMWRITE_JPEG_QUALITY = 1; - CV_IMWRITE_PNG_COMPRESSION = 16; - CV_IMWRITE_PNG_STRATEGY = 17; - CV_IMWRITE_PNG_STRATEGY_DEFAULT = 0; - CV_IMWRITE_PNG_STRATEGY_FILTERED = 1; + CV_IMWRITE_JPEG_QUALITY = 1; + CV_IMWRITE_PNG_COMPRESSION = 16; + CV_IMWRITE_PNG_STRATEGY = 17; + CV_IMWRITE_PNG_STRATEGY_DEFAULT = 0; + CV_IMWRITE_PNG_STRATEGY_FILTERED = 1; CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2; - CV_IMWRITE_PNG_STRATEGY_RLE = 3; - CV_IMWRITE_PNG_STRATEGY_FIXED = 4; - CV_IMWRITE_PXM_BINARY = 32; + CV_IMWRITE_PNG_STRATEGY_RLE = 3; + CV_IMWRITE_PNG_STRATEGY_FIXED = 4; + CV_IMWRITE_PXM_BINARY = 32; (* save image to file *) // CVAPI(Integer)cvSaveImage(PCVChar filename, CvArr * image, @@ -600,7 +600,7 @@ const CV_CVTIMG_FLIP =1, CV_CVTIMG_SWAP_RB =2 }; *) - CV_CVTIMG_FLIP = 1; + CV_CVTIMG_FLIP = 1; CV_CVTIMG_SWAP_RB = 2; (* @@ -642,12 +642,12 @@ Type {$IFDEF SAFELOADLIB} type - TcvSetOpenGlDrawCallback = procedure(const window_name: pCvChar; callback: TCvOpenGlDrawCallback; userdata: Pointer = nil); + TcvSetOpenGlDrawCallback = procedure(const window_name: pCvChar; callback: TCvOpenGlDrawCallback; userdata: Pointer = nil); cdecl; var cvSetOpenGlDrawCallback: TcvSetOpenGlDrawCallback; {$ELSE} -procedure cvSetOpenGlDrawCallback(const window_name: pCvChar; callback: TCvOpenGlDrawCallback; userdata: Pointer = nil); +procedure cvSetOpenGlDrawCallback(const window_name: pCvChar; callback: TCvOpenGlDrawCallback; userdata: Pointer = nil); cdecl; {$ENDIF} // CVAPI( procedure)cvSetOpenGlContext(window_name: PCVChar); {$IFDEF SAFELOADLIB} @@ -697,36 +697,36 @@ function cvCreateFileCapture(const filename: pCvChar): pCvCapture; cdecl; {$ENDIF} const - CV_CAP_ANY = 0; // autodetect - CV_CAP_CAM_0 = CV_CAP_ANY; - CV_CAP_CAM_1 = 1; - CV_CAP_CAM_2 = 2; - CV_CAP_CAM_3 = 3; - CV_CAP_CAM_4 = 4; - CV_CAP_CAM_5 = 5; - CV_CAP_MIL = 100; // MIL proprietary drivers - CV_CAP_VFW = 200; // platform native - CV_CAP_V4L = 200; - CV_CAP_V4L2 = 200; - CV_CAP_FIREWARE = 300; // IEEE 1394 drivers - CV_CAP_FIREWIRE = 300; - CV_CAP_IEEE1394 = 300; - CV_CAP_DC1394 = 300; - CV_CAP_CMU1394 = 300; - CV_CAP_STEREO = 400; // TYZX proprietary drivers - CV_CAP_TYZX = 400; - CV_TYZX_LEFT = 400; - CV_TYZX_RIGHT = 401; - CV_TYZX_COLOR = 402; - CV_TYZX_Z = 403; - CV_CAP_QT = 500; // QuickTime - CV_CAP_UNICAP = 600; // Unicap drivers - CV_CAP_DSHOW = 700; // DirectShow (via videoInput) - CV_CAP_PVAPI = 800; // PvAPI; Prosilica GigE SDK - CV_CAP_OPENNI = 900; // OpenNI (for Kinect) - CV_CAP_OPENNI_ASUS = 910; // OpenNI (for Asus Xtion) - CV_CAP_ANDROID = 1000; // Android - CV_CAP_XIAPI = 1100; // XIMEA Camera API + CV_CAP_ANY = 0; // autodetect + CV_CAP_CAM_0 = CV_CAP_ANY; + CV_CAP_CAM_1 = 1; + CV_CAP_CAM_2 = 2; + CV_CAP_CAM_3 = 3; + CV_CAP_CAM_4 = 4; + CV_CAP_CAM_5 = 5; + CV_CAP_MIL = 100; // MIL proprietary drivers + CV_CAP_VFW = 200; // platform native + CV_CAP_V4L = 200; + CV_CAP_V4L2 = 200; + CV_CAP_FIREWARE = 300; // IEEE 1394 drivers + CV_CAP_FIREWIRE = 300; + CV_CAP_IEEE1394 = 300; + CV_CAP_DC1394 = 300; + CV_CAP_CMU1394 = 300; + CV_CAP_STEREO = 400; // TYZX proprietary drivers + CV_CAP_TYZX = 400; + CV_TYZX_LEFT = 400; + CV_TYZX_RIGHT = 401; + CV_TYZX_COLOR = 402; + CV_TYZX_Z = 403; + CV_CAP_QT = 500; // QuickTime + CV_CAP_UNICAP = 600; // Unicap drivers + CV_CAP_DSHOW = 700; // DirectShow (via videoInput) + CV_CAP_PVAPI = 800; // PvAPI; Prosilica GigE SDK + CV_CAP_OPENNI = 900; // OpenNI (for Kinect) + CV_CAP_OPENNI_ASUS = 910; // OpenNI (for Asus Xtion) + CV_CAP_ANDROID = 1000; // Android + CV_CAP_XIAPI = 1100; // XIMEA Camera API CV_CAP_AVFOUNDATION = 1200; // AVFoundation framework for iOS (OS X Lion will have the same API); @@ -777,7 +777,7 @@ function cvRetrieveFrame(capture: pCvCapture; streamIdx: Integer = 0): pIplImage {$ENDIF} (* Just a combination of cvGrabFrame and cvRetrieveFrame not not not DO NOT RELEASE or MODIFY the retrieved frame not not not *) -// CVAPI(IplImage*) cvQueryFrame( CvCapture* capture ); +// CVAPI(IplImage* ) cvQueryFrame( CvCapture* capture ); {$IFDEF SAFELOADLIB} type @@ -808,75 +808,75 @@ const // turn the feature off (not controlled manually nor automatically) CV_CAP_PROP_DC1394_MODE_MANUAL = -3; // set automatically when a value of the feature is set by the user - CV_CAP_PROP_DC1394_MODE_AUTO = -2; + CV_CAP_PROP_DC1394_MODE_AUTO = -2; CV_CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO = -1; - CV_CAP_PROP_POS_MSEC = 0; - CV_CAP_PROP_POS_FRAMES = 1; - CV_CAP_PROP_POS_AVI_RATIO = 2; - CV_CAP_PROP_FRAME_WIDTH = 3; - CV_CAP_PROP_FRAME_HEIGHT = 4; - CV_CAP_PROP_FPS = 5; - CV_CAP_PROP_FOURCC = 6; - CV_CAP_PROP_FRAME_COUNT = 7; - CV_CAP_PROP_FORMAT = 8; - CV_CAP_PROP_MODE = 9; - CV_CAP_PROP_BRIGHTNESS = 10; - CV_CAP_PROP_CONTRAST = 11; - CV_CAP_PROP_SATURATION = 12; - CV_CAP_PROP_HUE = 13; - CV_CAP_PROP_GAIN = 14; - CV_CAP_PROP_EXPOSURE = 15; - CV_CAP_PROP_CONVERT_RGB = 16; - CV_CAP_PROP_WHITE_BALANCE_BLUE_U = 17; - CV_CAP_PROP_RECTIFICATION = 18; - CV_CAP_PROP_MONOCROME = 19; - CV_CAP_PROP_SHARPNESS = 20; - CV_CAP_PROP_AUTO_EXPOSURE = 21; // exposure control done by camera; + CV_CAP_PROP_POS_MSEC = 0; + CV_CAP_PROP_POS_FRAMES = 1; + CV_CAP_PROP_POS_AVI_RATIO = 2; + CV_CAP_PROP_FRAME_WIDTH = 3; + CV_CAP_PROP_FRAME_HEIGHT = 4; + CV_CAP_PROP_FPS = 5; + CV_CAP_PROP_FOURCC = 6; + CV_CAP_PROP_FRAME_COUNT = 7; + CV_CAP_PROP_FORMAT = 8; + CV_CAP_PROP_MODE = 9; + CV_CAP_PROP_BRIGHTNESS = 10; + CV_CAP_PROP_CONTRAST = 11; + CV_CAP_PROP_SATURATION = 12; + CV_CAP_PROP_HUE = 13; + CV_CAP_PROP_GAIN = 14; + CV_CAP_PROP_EXPOSURE = 15; + CV_CAP_PROP_CONVERT_RGB = 16; + CV_CAP_PROP_WHITE_BALANCE_BLUE_U = 17; + CV_CAP_PROP_RECTIFICATION = 18; + CV_CAP_PROP_MONOCROME = 19; + CV_CAP_PROP_SHARPNESS = 20; + CV_CAP_PROP_AUTO_EXPOSURE = 21; // exposure control done by camera; // user can adjust refernce level; // using this feature; - CV_CAP_PROP_GAMMA = 22; - CV_CAP_PROP_TEMPERATURE = 23; - CV_CAP_PROP_TRIGGER = 24; - CV_CAP_PROP_TRIGGER_DELAY = 25; - CV_CAP_PROP_WHITE_BALANCE_RED_V = 26; - CV_CAP_PROP_ZOOM = 27; - CV_CAP_PROP_FOCUS = 28; - CV_CAP_PROP_GUID = 29; - CV_CAP_PROP_ISO_SPEED = 30; - CV_CAP_PROP_MAX_DC1394 = 31; - CV_CAP_PROP_BACKLIGHT = 32; - CV_CAP_PROP_PAN = 33; - CV_CAP_PROP_TILT = 34; - CV_CAP_PROP_ROLL = 35; - CV_CAP_PROP_IRIS = 36; - CV_CAP_PROP_SETTINGS = 37; - CV_CAP_PROP_AUTOGRAB = 1024; // property for highgui class CvCapture_Android only + CV_CAP_PROP_GAMMA = 22; + CV_CAP_PROP_TEMPERATURE = 23; + CV_CAP_PROP_TRIGGER = 24; + CV_CAP_PROP_TRIGGER_DELAY = 25; + CV_CAP_PROP_WHITE_BALANCE_RED_V = 26; + CV_CAP_PROP_ZOOM = 27; + CV_CAP_PROP_FOCUS = 28; + CV_CAP_PROP_GUID = 29; + CV_CAP_PROP_ISO_SPEED = 30; + CV_CAP_PROP_MAX_DC1394 = 31; + CV_CAP_PROP_BACKLIGHT = 32; + CV_CAP_PROP_PAN = 33; + CV_CAP_PROP_TILT = 34; + CV_CAP_PROP_ROLL = 35; + CV_CAP_PROP_IRIS = 36; + CV_CAP_PROP_SETTINGS = 37; + CV_CAP_PROP_AUTOGRAB = 1024; // property for highgui class CvCapture_Android only CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING = 1025; // readonly; tricky property; returns cpnst char* indeed - CV_CAP_PROP_PREVIEW_FORMAT = 1026; // readonly; tricky property; returns cpnst char* indeed + CV_CAP_PROP_PREVIEW_FORMAT = 1026; // readonly; tricky property; returns cpnst char* indeed // OpenNI map generators; CV_CAP_OPENNI_DEPTH_GENERATOR = 1 shl 31; CV_CAP_OPENNI_IMAGE_GENERATOR = 1 shl 30; CV_CAP_OPENNI_GENERATORS_MASK = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_OPENNI_IMAGE_GENERATOR; // Properties of cameras available through OpenNI interfaces; - CV_CAP_PROP_OPENNI_OUTPUT_MODE = 100; + CV_CAP_PROP_OPENNI_OUTPUT_MODE = 100; CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH = 101; // in mm - CV_CAP_PROP_OPENNI_BASELINE = 102; // in mm - CV_CAP_PROP_OPENNI_FOCAL_LENGTH = 103; // in pixels - CV_CAP_PROP_OPENNI_REGISTRATION = 104; // flag + CV_CAP_PROP_OPENNI_BASELINE = 102; // in mm + CV_CAP_PROP_OPENNI_FOCAL_LENGTH = 103; // in pixels + CV_CAP_PROP_OPENNI_REGISTRATION = 104; // flag CV_CAP_PROP_OPENNI_REGISTRATION_ON = CV_CAP_PROP_OPENNI_REGISTRATION; // flag that synchronizes the remapping depth map to image map // by changing depth generator's view point (if the flag is "on") or; // sets this view point to its normal one (if the flag is "off").; - CV_CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105; - CV_CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106; - CV_CAP_PROP_OPENNI_CIRCLE_BUFFER = 107; - CV_CAP_PROP_OPENNI_MAX_TIME_DURATION = 108; - CV_CAP_PROP_OPENNI_GENERATOR_PRESENT = 109; - CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT; - CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE; - CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_BASELINE; - CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH; - CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION; + CV_CAP_PROP_OPENNI_APPROX_FRAME_SYNC = 105; + CV_CAP_PROP_OPENNI_MAX_BUFFER_SIZE = 106; + CV_CAP_PROP_OPENNI_CIRCLE_BUFFER = 107; + CV_CAP_PROP_OPENNI_MAX_TIME_DURATION = 108; + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT = 109; + CV_CAP_OPENNI_IMAGE_GENERATOR_PRESENT = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_GENERATOR_PRESENT; + CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE = CV_CAP_OPENNI_IMAGE_GENERATOR + CV_CAP_PROP_OPENNI_OUTPUT_MODE; + CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_BASELINE; + CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH; + CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_REGISTRATION; CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON = CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION; // Properties of cameras available through GStreamer interface; CV_CAP_GSTREAMER_QUEUE_LENGTH = 200; // default is 1 @@ -884,24 +884,24 @@ const // ip for anable multicast master mode. 0 for disable multicast // Properties of cameras available through XIMEA SDK interface; CV_CAP_PROP_XI_DOWNSAMPLING = 400; // Change image resolution by binning or skipping. - CV_CAP_PROP_XI_DATA_FORMAT = 401; // Output data format. - CV_CAP_PROP_XI_OFFSET_X = 402; + CV_CAP_PROP_XI_DATA_FORMAT = 401; // Output data format. + CV_CAP_PROP_XI_OFFSET_X = 402; // Horizontal offset from the origin to the area of interest (in pixels). CV_CAP_PROP_XI_OFFSET_Y = 403; // Vertical offset from the origin to the area of interest (in pixels). - CV_CAP_PROP_XI_TRG_SOURCE = 404; // Defines source of trigger. + CV_CAP_PROP_XI_TRG_SOURCE = 404; // Defines source of trigger. CV_CAP_PROP_XI_TRG_SOFTWARE = 405; // Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. CV_CAP_PROP_XI_GPI_SELECTOR = 406; // Selects general purpose input - CV_CAP_PROP_XI_GPI_MODE = 407; // Set general purpose input mode - CV_CAP_PROP_XI_GPI_LEVEL = 408; // Get general purpose level + CV_CAP_PROP_XI_GPI_MODE = 407; // Set general purpose input mode + CV_CAP_PROP_XI_GPI_LEVEL = 408; // Get general purpose level CV_CAP_PROP_XI_GPO_SELECTOR = 409; // Selects general purpose output - CV_CAP_PROP_XI_GPO_MODE = 410; // Set general purpose output mode + CV_CAP_PROP_XI_GPO_MODE = 410; // Set general purpose output mode CV_CAP_PROP_XI_LED_SELECTOR = 411; // Selects camera signalling LED - CV_CAP_PROP_XI_LED_MODE = 412; // Define camera signalling LED functionality - CV_CAP_PROP_XI_MANUAL_WB = 413; // Calculates White Balance(must be called during acquisition) - CV_CAP_PROP_XI_AUTO_WB = 414; // Automatic white balance - CV_CAP_PROP_XI_AEAG = 415; // Automatic exposure/gain + CV_CAP_PROP_XI_LED_MODE = 412; // Define camera signalling LED functionality + CV_CAP_PROP_XI_MANUAL_WB = 413; // Calculates White Balance(must be called during acquisition) + CV_CAP_PROP_XI_AUTO_WB = 414; // Automatic white balance + CV_CAP_PROP_XI_AEAG = 415; // Automatic exposure/gain CV_CAP_PROP_XI_EXP_PRIORITY = 416; // Exposure priority (0.5 - exposure 50%; gain 50%). CV_CAP_PROP_XI_AE_MAX_LIMIT = 417; // Maximum limit of exposure in AEAG procedure CV_CAP_PROP_XI_AG_MAX_LIMIT = 418; // Maximum limit of gain in AEAG procedure @@ -909,67 +909,67 @@ const // Average intensity of output signal AEAG should achieve(in %) CV_CAP_PROP_XI_TIMEOUT = 420; // Image capture timeout in milliseconds // Properties for Android cameras; - CV_CAP_PROP_ANDROID_FLASH_MODE = 8001; - CV_CAP_PROP_ANDROID_FOCUS_MODE = 8002; - CV_CAP_PROP_ANDROID_WHITE_BALANCE = 8003; - CV_CAP_PROP_ANDROID_ANTIBANDING = 8004; - CV_CAP_PROP_ANDROID_FOCAL_LENGTH = 8005; - CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006; + CV_CAP_PROP_ANDROID_FLASH_MODE = 8001; + CV_CAP_PROP_ANDROID_FOCUS_MODE = 8002; + CV_CAP_PROP_ANDROID_WHITE_BALANCE = 8003; + CV_CAP_PROP_ANDROID_ANTIBANDING = 8004; + CV_CAP_PROP_ANDROID_FOCAL_LENGTH = 8005; + CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_NEAR = 8006; CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_OPTIMAL = 8007; - CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008; + CV_CAP_PROP_ANDROID_FOCUS_DISTANCE_FAR = 8008; // Properties of cameras available through AVFOUNDATION interface; - CV_CAP_PROP_IOS_DEVICE_FOCUS = 9001; - CV_CAP_PROP_IOS_DEVICE_EXPOSURE = 9002; - CV_CAP_PROP_IOS_DEVICE_FLASH = 9003; + CV_CAP_PROP_IOS_DEVICE_FOCUS = 9001; + CV_CAP_PROP_IOS_DEVICE_EXPOSURE = 9002; + CV_CAP_PROP_IOS_DEVICE_FLASH = 9003; CV_CAP_PROP_IOS_DEVICE_WHITEBALANCE = 9004; - CV_CAP_PROP_IOS_DEVICE_TORCH = 9005; + CV_CAP_PROP_IOS_DEVICE_TORCH = 9005; // Data given from depth generator.; - CV_CAP_OPENNI_DEPTH_MAP = 0; // Depth values in mm (CV_16UC1) - CV_CAP_OPENNI_POINT_CLOUD_MAP = 1; // XYZ in meters (CV_32FC3) - CV_CAP_OPENNI_DISPARITY_MAP = 2; // Disparity in pixels (CV_8UC1) + CV_CAP_OPENNI_DEPTH_MAP = 0; // Depth values in mm (CV_16UC1) + CV_CAP_OPENNI_POINT_CLOUD_MAP = 1; // XYZ in meters (CV_32FC3) + CV_CAP_OPENNI_DISPARITY_MAP = 2; // Disparity in pixels (CV_8UC1) CV_CAP_OPENNI_DISPARITY_MAP_32F = 3; // Disparity in pixels (CV_32FC1) - CV_CAP_OPENNI_VALID_DEPTH_MASK = 4; // CV_8UC1 + CV_CAP_OPENNI_VALID_DEPTH_MASK = 4; // CV_8UC1 // Data given from RGB image generator.; - CV_CAP_OPENNI_BGR_IMAGE = 5; + CV_CAP_OPENNI_BGR_IMAGE = 5; CV_CAP_OPENNI_GRAY_IMAGE = 6; // Supported output modes of OpenNI image generator - CV_CAP_OPENNI_VGA_30HZ = 0; + CV_CAP_OPENNI_VGA_30HZ = 0; CV_CAP_OPENNI_SXGA_15HZ = 1; CV_CAP_OPENNI_SXGA_30HZ = 2; // supported by Android camera output formats - CV_CAP_ANDROID_COLOR_FRAME_BGR = 0; // BGR - CV_CAP_ANDROID_COLOR_FRAME = CV_CAP_ANDROID_COLOR_FRAME_BGR; - CV_CAP_ANDROID_GREY_FRAME = 1; // Y - CV_CAP_ANDROID_COLOR_FRAME_RGB = 2; + CV_CAP_ANDROID_COLOR_FRAME_BGR = 0; // BGR + CV_CAP_ANDROID_COLOR_FRAME = CV_CAP_ANDROID_COLOR_FRAME_BGR; + CV_CAP_ANDROID_GREY_FRAME = 1; // Y + CV_CAP_ANDROID_COLOR_FRAME_RGB = 2; CV_CAP_ANDROID_COLOR_FRAME_BGRA = 3; CV_CAP_ANDROID_COLOR_FRAME_RGBA = 4; // supported Android camera flash modes - CV_CAP_ANDROID_FLASH_MODE_AUTO = 0; - CV_CAP_ANDROID_FLASH_MODE_OFF = 0; - CV_CAP_ANDROID_FLASH_MODE_ON = 1; + CV_CAP_ANDROID_FLASH_MODE_AUTO = 0; + CV_CAP_ANDROID_FLASH_MODE_OFF = 0; + CV_CAP_ANDROID_FLASH_MODE_ON = 1; CV_CAP_ANDROID_FLASH_MODE_RED_EYE = 2; - CV_CAP_ANDROID_FLASH_MODE_TORCH = 3; + CV_CAP_ANDROID_FLASH_MODE_TORCH = 3; // supported Android camera focus modes - CV_CAP_ANDROID_FOCUS_MODE_AUTO = 0; + CV_CAP_ANDROID_FOCUS_MODE_AUTO = 0; CV_CAP_ANDROID_FOCUS_MODE_CONTINUOUS_VIDEO = 0; - CV_CAP_ANDROID_FOCUS_MODE_EDOF = 1; - CV_CAP_ANDROID_FOCUS_MODE_FIXED = 2; - CV_CAP_ANDROID_FOCUS_MODE_INFINITY = 3; - CV_CAP_ANDROID_FOCUS_MODE_MACRO = 4; + CV_CAP_ANDROID_FOCUS_MODE_EDOF = 1; + CV_CAP_ANDROID_FOCUS_MODE_FIXED = 2; + CV_CAP_ANDROID_FOCUS_MODE_INFINITY = 3; + CV_CAP_ANDROID_FOCUS_MODE_MACRO = 4; // supported Android camera white balance modes - CV_CAP_ANDROID_WHITE_BALANCE_AUTO = 0; - CV_CAP_ANDROID_WHITE_BALANCE_CLOUDY_DAYLIGHT = 0; - CV_CAP_ANDROID_WHITE_BALANCE_DAYLIGHT = 1; - CV_CAP_ANDROID_WHITE_BALANCE_FLUORESCENT = 2; - CV_CAP_ANDROID_WHITE_BALANCE_INCANDESCENT = 3; - CV_CAP_ANDROID_WHITE_BALANCE_SHADE = 4; - CV_CAP_ANDROID_WHITE_BALANCE_TWILIGHT = 5; + CV_CAP_ANDROID_WHITE_BALANCE_AUTO = 0; + CV_CAP_ANDROID_WHITE_BALANCE_CLOUDY_DAYLIGHT = 0; + CV_CAP_ANDROID_WHITE_BALANCE_DAYLIGHT = 1; + CV_CAP_ANDROID_WHITE_BALANCE_FLUORESCENT = 2; + CV_CAP_ANDROID_WHITE_BALANCE_INCANDESCENT = 3; + CV_CAP_ANDROID_WHITE_BALANCE_SHADE = 4; + CV_CAP_ANDROID_WHITE_BALANCE_TWILIGHT = 5; CV_CAP_ANDROID_WHITE_BALANCE_WARM_FLUORESCENT = 6; // supported Android camera antibanding modes CV_CAP_ANDROID_ANTIBANDING_50HZ = 0; CV_CAP_ANDROID_ANTIBANDING_60HZ = 0; CV_CAP_ANDROID_ANTIBANDING_AUTO = 1; - CV_CAP_ANDROID_ANTIBANDING_OFF = 2; + CV_CAP_ANDROID_ANTIBANDING_OFF = 2; (* retrieve or set capture properties *) {$IFDEF SAFELOADLIB} @@ -1031,23 +1031,21 @@ const // CvSize frame_size, // function is_color CV_DEFAULT(v1: 1)): Integer; { - CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char* filename, int fourcc, + CVAPI(CvVideoWriter* ) cvCreateVideoWriter(const char* filename, int fourcc, double fps, CvSize frame_size, int is_color CV_DEFAULT(1)); } type - TcvCreateVideoWriter = function(const filename: pCvChar; fourcc: Integer; fps: Double; frame_size: TCvSize; is_color: Integer = 1) - : pCvVideoWriter; cdecl; + TcvCreateVideoWriter = function(const filename: pCvChar; fourcc: Integer; fps: Double; frame_size: TCvSize; is_color: Integer = 1): pCvVideoWriter; cdecl; {$IFDEF SAFELOADLIB} var cvCreateVideoWriter: TcvCreateVideoWriter; {$ELSE} -function cvCreateVideoWriter(const filename: pCvChar; fourcc: Integer; fps: Double; frame_size: TCvSize; is_color: Integer = 1) - : pCvVideoWriter; cdecl; +function cvCreateVideoWriter(const filename: pCvChar; fourcc: Integer; fps: Double; frame_size: TCvSize; is_color: Integer = 1): pCvVideoWriter; cdecl; {$ENDIF} function CV_FOURCC(const c1, c2, c3, c4: CVChar): Integer; {$IFDEF USE_INLINE}inline; {$ENDIF} -// CVAPI(CvVideoWriter*) cvCreateImageSequenceWriter( const char* filename, +// CVAPI(CvVideoWriter* ) cvCreateImageSequenceWriter( const char* filename, // int is_color CV_DEFAULT(1)); (* write frame to video file *) @@ -1078,41 +1076,41 @@ procedure cvReleaseVideoWriter(Var writer: pCvVideoWriter); cdecl; * Obsolete functions/synonyms * *************************************************************************************** *) Var - cvCaptureFromFile: TcvCreateFileCapture {$IFNDEF SAFELOADLIB} = cvCreateFileCapture{$ENDIF}; + cvCaptureFromFile: TcvCreateFileCapture; //{$IFNDEF SAFELOADLIB} = cvCreateFileCapture{$ENDIF}; {$EXTERNALSYM cvCaptureFromFile} - cvCaptureFromCAM: TcvCreateCameraCapture {$IFNDEF SAFELOADLIB} = cvCreateCameraCapture{$ENDIF}; + cvCaptureFromCAM: TcvCreateCameraCapture;// {$IFNDEF SAFELOADLIB} = cvCreateCameraCapture{$ENDIF}; {$EXTERNALSYM cvCaptureFromCAM} - cvCaptureFromAVI: TcvCreateFileCapture {$IFNDEF SAFELOADLIB} = cvCreateFileCapture{$ENDIF}; + cvCaptureFromAVI: TcvCreateFileCapture;// {$IFNDEF SAFELOADLIB} = cvCreateFileCapture{$ENDIF}; {$EXTERNALSYM cvCaptureFromAVI} - cvCreateAVIWriter: TcvCreateVideoWriter {$IFNDEF SAFELOADLIB} = cvCreateVideoWriter{$ENDIF}; + cvCreateAVIWriter: TcvCreateVideoWriter;// {$IFNDEF SAFELOADLIB} = cvCreateVideoWriter{$ENDIF}; {$EXTERNALSYM cvCreateAVIWriter} - cvWriteToAVI: TcvWriteFrame {$IFNDEF SAFELOADLIB} = cvWriteFrame{$ENDIF}; + cvWriteToAVI: TcvWriteFrame;// {$IFNDEF SAFELOADLIB} = cvWriteFrame{$ENDIF}; {$EXTERNALSYM cvWriteToAVI} // {$DEFINE cvAddSearchPath(path)} - cvvInitSystem: TcvInitSystem {$IFNDEF SAFELOADLIB} = cvInitSystem{$ENDIF}; + cvvInitSystem: TcvInitSystem;// {$IFNDEF SAFELOADLIB} = cvInitSystem{$ENDIF}; {$EXTERNALSYM cvvInitSystem} - cvvNamedWindow: TcvNamedWindow {$IFNDEF SAFELOADLIB} = cvNamedWindow{$ENDIF}; + cvvNamedWindow: TcvNamedWindow;// {$IFNDEF SAFELOADLIB} = cvNamedWindow{$ENDIF}; {$EXTERNALSYM cvvNamedWindow} - cvvShowImage: TcvShowImage {$IFNDEF SAFELOADLIB} = cvShowImage{$ENDIF}; + cvvShowImage: TcvShowImage;// {$IFNDEF SAFELOADLIB} = cvShowImage{$ENDIF}; {$EXTERNALSYM cvvShowImage} - cvvResizeWindow: TcvResizeWindow {$IFNDEF SAFELOADLIB} = cvResizeWindow{$ENDIF}; + cvvResizeWindow: TcvResizeWindow;// {$IFNDEF SAFELOADLIB} = cvResizeWindow{$ENDIF}; {$EXTERNALSYM cvvResizeWindow} - cvvDestroyWindow: TcvDestroyWindow {$IFNDEF SAFELOADLIB} = cvDestroyWindow{$ENDIF}; + cvvDestroyWindow: TcvDestroyWindow;// {$IFNDEF SAFELOADLIB} = cvDestroyWindow{$ENDIF}; {$EXTERNALSYM cvvDestroyWindow} - cvvCreateTrackbar: TcvCreateTrackbar {$IFNDEF SAFELOADLIB} = cvCreateTrackbar{$ENDIF}; + cvvCreateTrackbar: TcvCreateTrackbar;// {$IFNDEF SAFELOADLIB} = cvCreateTrackbar{$ENDIF}; {$EXTERNALSYM cvvCreateTrackbar} /// / >> Following declaration is a macro definition! - cvvLoadImage: TcvLoadImage {$IFNDEF SAFELOADLIB} = cvLoadImage{$ENDIF}; - cvvSaveImage: TcvSaveImage {$IFNDEF SAFELOADLIB} = cvSaveImage{$ENDIF}; + cvvLoadImage: TcvLoadImage;// {$IFNDEF SAFELOADLIB} = cvLoadImage{$ENDIF}; + cvvSaveImage: TcvSaveImage;// {$IFNDEF SAFELOADLIB} = cvSaveImage{$ENDIF}; {$EXTERNALSYM cvvSaveImage} // cvvAddSearchPath: TcvAddSearchPath{$IFNDEF SAFELOADLIB} = cvAddSearchPath{$ENDIF}; // {$EXTERNALSYM cvvAddSearchPath} /// / >> Following declaration is a macro definition! - cvvWaitKey: TcvWaitKey{$IFNDEF SAFELOADLIB} = cvWaitKey{$ENDIF}; + cvvWaitKey: TcvWaitKey;//{$IFNDEF SAFELOADLIB} = cvWaitKey{$ENDIF}; /// / >> Following declaration is a macro definition! // const cvvWaitKeyEx(name, delay)cvWaitKey(delay); // - cvvConvertImage: TcvConvertImage {$IFNDEF SAFELOADLIB} = cvConvertImage{$ENDIF}; + cvvConvertImage: TcvConvertImage;// {$IFNDEF SAFELOADLIB} = cvConvertImage{$ENDIF}; {$EXTERNALSYM cvvConvertImage} const @@ -1121,6 +1119,7 @@ const // CVAPI(void) cvSetPreprocessFuncWin32_(const void* callback); Type TcvSetPreprocessFuncWin32_ = procedure(const callback: Pointer); cdecl; + {$IFDEF SAFELOADLIB} var @@ -1141,16 +1140,16 @@ procedure cvSetPostprocessFuncWin32_(const callback: Pointer); cdecl; {$ENDIF} var - cvSetPreprocessFuncWin32: TcvSetPreprocessFuncWin32_ {$IFNDEF SAFELOADLIB} = cvSetPreprocessFuncWin32_{$ENDIF}; - cvSetPostprocessFuncWin32: TcvSetPostprocessFuncWin32_ {$IFNDEF SAFELOADLIB} = cvSetPostprocessFuncWin32_{$ENDIF}; + cvSetPreprocessFuncWin32: TcvSetPreprocessFuncWin32_;// {$IFNDEF SAFELOADLIB} = cvSetPreprocessFuncWin32_{$ENDIF}; + cvSetPostprocessFuncWin32: TcvSetPostprocessFuncWin32_;// {$IFNDEF SAFELOADLIB} = cvSetPostprocessFuncWin32_{$ENDIF}; {$EXTERNALSYM HG_AUTOSIZE} - set_preprocess_func: TcvSetPreprocessFuncWin32_ {$IFNDEF SAFELOADLIB} = cvSetPreprocessFuncWin32_{$ENDIF}; + set_preprocess_func: TcvSetPreprocessFuncWin32_;// {$IFNDEF SAFELOADLIB} = cvSetPreprocessFuncWin32_{$ENDIF}; {$EXTERNALSYM set_preprocess_func} - set_postprocess_func: TcvSetPostprocessFuncWin32_ {$IFNDEF SAFELOADLIB} = cvSetPostprocessFuncWin32_{$ENDIF}; + set_postprocess_func: TcvSetPostprocessFuncWin32_;// {$IFNDEF SAFELOADLIB} = cvSetPostprocessFuncWin32_{$ENDIF}; -{$IF DEFINED(SAFELOADLIB) AND DEFINED(DEBUG)} -procedure Init_highgui_c_lib; -{$IFEND} + // {$IF DEFINED(SAFELOADLIB) AND DEFINED(DEBUG)} + // procedure Init_highgui_c_lib; + // {$IFEND} implementation @@ -1222,62 +1221,39 @@ begin cvGetCaptureDomain := ocvGetProcAddress('cvGetCaptureDomain', highguiDLL); cvSetPreprocessFuncWin32_ := ocvGetProcAddress('cvSetPreprocessFuncWin32_', highguiDLL); cvSetPostprocessFuncWin32_ := ocvGetProcAddress('cvSetPostprocessFuncWin32_', highguiDLL); - - cvCaptureFromFile := cvCreateFileCapture; - cvCaptureFromCAM := cvCreateCameraCapture; - cvCaptureFromAVI := cvCreateFileCapture; - cvCreateAVIWriter := cvCreateVideoWriter; - cvWriteToAVI := cvWriteFrame; - cvvInitSystem := cvInitSystem; - cvvNamedWindow := cvNamedWindow; - cvvShowImage := cvShowImage; - cvvResizeWindow := cvResizeWindow; - cvvDestroyWindow := cvDestroyWindow; - cvvCreateTrackbar := cvCreateTrackbar; - cvvLoadImage := cvLoadImage; - cvvSaveImage := cvSaveImage; - cvvWaitKey := cvWaitKey; - cvvConvertImage := cvConvertImage; - - cvSetPreprocessFuncWin32 := cvSetPreprocessFuncWin32_; - cvSetPostprocessFuncWin32 := cvSetPostprocessFuncWin32_; - set_preprocess_func := cvSetPreprocessFuncWin32_; - set_postprocess_func := cvSetPostprocessFuncWin32_; end; -initialization - -Init_highgui_c_lib; - {$ELSE} -function cvNamedWindow; external highgui_lib; -procedure cvShowImage; external highgui_lib; -function cvWaitKey; external highgui_lib; -procedure cvDestroyWindow; external highgui_lib; -procedure cvDestroyAllWindows; external highgui_lib; -function cvLoadImage; external highgui_lib; -function cvCreateFileCapture; external highgui_lib; -function cvQueryFrame; external highgui_lib; -procedure cvReleaseCapture; external highgui_lib; -function cvSetCaptureProperty; external highgui_lib; -function cvGetCaptureProperty; external highgui_lib; -function cvCreateTrackbar; external highgui_lib; -function cvCreateCameraCapture; external highgui_lib; -function cvSaveImage; external highgui_lib; -function cvCreateVideoWriter; external highgui_lib; -function cvWriteFrame; external highgui_lib; -procedure cvReleaseVideoWriter; external highgui_lib; -procedure cvSetMouseCallback; external highgui_lib; -procedure cvConvertImage; cdecl; external highgui_lib; -procedure cvMoveWindow; external highgui_lib; -procedure cvResizeWindow; external highgui_lib; -procedure cvSetWindowProperty; external highgui_lib; -function cvGetWindowProperty; external highgui_lib; -function cvInitSystem; external highgui_lib; -function cvStartWindowThread; external highgui_lib; -function cvCreateTrackbar2; external highgui_lib; -function cvGetTrackbarPos; external highgui_lib; -procedure cvSetTrackbarPos; external highgui_lib; +function cvNamedWindow(const name: pCvChar; flags: Integer = CV_WINDOW_AUTOSIZE): Integer; cdecl; external highgui_lib; +procedure cvShowImage(const name: pCvChar; const image: pCvArr); cdecl; external highgui_lib; +function cvWaitKey(delay: Integer = 0): Integer; cdecl; external highgui_lib; +procedure cvDestroyWindow(const name: pCvChar); cdecl; external highgui_lib; +procedure cvDestroyAllWindows; cdecl; external highgui_lib; +function cvLoadImage(const filename: pCvChar; iscolor: Integer = CV_LOAD_IMAGE_UNCHANGED): pIplImage; cdecl; external highgui_lib; +function cvCreateFileCapture(const filename: pCvChar): pCvCapture; cdecl; external highgui_lib; +function cvQueryFrame(capture: pCvCapture): pIplImage; cdecl; external highgui_lib; +procedure cvReleaseCapture(Var capture: pCvCapture); cdecl; external highgui_lib; +function cvSetCaptureProperty(capture: pCvCapture; property_id: Integer; value: Double): Integer; cdecl; external highgui_lib; +function cvGetCaptureProperty(capture: pCvCapture; property_id: Integer): Double; cdecl; external highgui_lib; +function cvCreateTrackbar(const trackbar_name: pCvChar; const window_name: pCvChar; value: PInteger; count: Integer; on_change: TCvTrackbarCallback) + : Integer; cdecl; external highgui_lib; +function cvCreateCameraCapture(index: Longint): pCvCapture; cdecl; external highgui_lib; +function cvSaveImage(const filename: pCvChar; const image: Pointer; const params: PInteger = nil): Integer; cdecl; external highgui_lib; +function cvCreateVideoWriter(const filename: pCvChar; fourcc: Integer; fps: Double; frame_size: TCvSize; is_color: Integer = 1): pCvVideoWriter; cdecl; external highgui_lib; +function cvWriteFrame(writer: pCvVideoWriter; image: pIplImage): Integer; cdecl; external highgui_lib; +procedure cvReleaseVideoWriter(Var writer: pCvVideoWriter); cdecl; external highgui_lib; +procedure cvSetMouseCallback(const window_name: pCvChar; on_mouse: TCvMouseCallback; param: Pointer = nil); cdecl; external highgui_lib; +procedure cvConvertImage(const src: pCvArr; dst: pCvArr; flags: Integer = 0); cdecl; external highgui_lib; +procedure cvMoveWindow(const name: pCvChar; x: Integer; y: Integer); cdecl; external highgui_lib; +procedure cvResizeWindow(name: pCvChar; width: Integer; height: Integer); cdecl; external highgui_lib; +procedure cvSetWindowProperty(name: pCvChar; prop_id: Integer; prop_value: Double); cdecl; external highgui_lib; +function cvGetWindowProperty(name: pCvChar; prop_id: Integer): Double; cdecl; external highgui_lib; +function cvInitSystem(argc: Integer; argv: ppCVChar): Integer; cdecl; external highgui_lib; +function cvStartWindowThread: Integer; cdecl; external highgui_lib; +function cvCreateTrackbar2(const trackbar_name: pCvChar; const window_name: pCvChar; value: PInteger; count: Integer; on_change: TCvTrackbarCallback2; + userdata: Pointer = nil): Integer; cdecl; external highgui_lib; +function cvGetTrackbarPos(const trackbar_name: pCvChar; const window_name: pCvChar): Integer; cdecl; external highgui_lib; +procedure cvSetTrackbarPos(const trackbar_name: pCvChar; const window_name: pCvChar; pos: Integer); cdecl; external highgui_lib; // function cvFontQt; external highgui_lib; // procedure cvAddText; external highgui_lib; // procedure cvDisplayOverlay; external highgui_lib; @@ -1287,20 +1263,46 @@ procedure cvSetTrackbarPos; external highgui_lib; // function cvStartLoop; external highgui_lib; // procedure cvStopLoop; external highgui_lib; // function cvCreateButton; external highgui_lib; -function cvGetWindowHandle; external highgui_lib; -function cvGetWindowName; external highgui_lib; -function cvLoadImageM; external highgui_lib; -function cvDecodeImage; external highgui_lib; -function cvDecodeImageM; external highgui_lib; -function cvEncodeImage; external highgui_lib; -procedure cvSetOpenGlDrawCallback; external highgui_lib; -procedure cvSetOpenGlContext; external highgui_lib; -procedure cvUpdateWindow; external highgui_lib; -function cvGrabFrame; external highgui_lib; -function cvRetrieveFrame; external highgui_lib; -function cvGetCaptureDomain; external highgui_lib; -procedure cvSetPreprocessFuncWin32_; external highgui_lib; -procedure cvSetPostprocessFuncWin32_; external highgui_lib; +function cvGetWindowHandle(const name: pCvChar): Pointer; cdecl; external highgui_lib; +function cvGetWindowName(window_handle: Pointer): pCvChar; cdecl; external highgui_lib; +function cvLoadImageM(const filename: pCvChar; iscolor: Integer = CV_LOAD_IMAGE_COLOR): pCvMat; cdecl; external highgui_lib; +function cvDecodeImage(const buf: pCvMat; iscolor: Integer = CV_LOAD_IMAGE_COLOR): pIplImage; cdecl; external highgui_lib; +function cvDecodeImageM(const buf: pCvMat; iscolor: Integer = CV_LOAD_IMAGE_COLOR): pCvMat; cdecl; external highgui_lib; +function cvEncodeImage(const ext: pCvChar; const image: pCvArr; const params: PInteger = nil): pCvMat; cdecl; external highgui_lib; +procedure cvSetOpenGlDrawCallback(const window_name: pCvChar; callback: TCvOpenGlDrawCallback; userdata: Pointer = nil); cdecl; external highgui_lib; +procedure cvSetOpenGlContext(window_name: pCvChar); cdecl; external highgui_lib; +procedure cvUpdateWindow(window_name: pCvChar); cdecl; external highgui_lib; +function cvGrabFrame(capture: pCvCapture): Integer; cdecl; external highgui_lib; +function cvRetrieveFrame(capture: pCvCapture; streamIdx: Integer = 0): pIplImage; cdecl; external highgui_lib; +function cvGetCaptureDomain(capture: pCvCapture): Integer; cdecl; external highgui_lib; +procedure cvSetPreprocessFuncWin32_(const callback: Pointer); cdecl; external highgui_lib; +procedure cvSetPostprocessFuncWin32_(const callback: Pointer); cdecl; external highgui_lib; {$ENDIF} +initialization + +{$IFDEF SAFELOADLIB} + Init_highgui_c_lib; +{$ENDIF} +cvCaptureFromFile := @cvCreateFileCapture; +cvCaptureFromCAM := @cvCreateCameraCapture; +cvCaptureFromAVI := @cvCreateFileCapture; +cvCreateAVIWriter := @cvCreateVideoWriter; +cvWriteToAVI := @cvWriteFrame; +cvvInitSystem := @cvInitSystem; +cvvNamedWindow := @cvNamedWindow; +cvvShowImage := @cvShowImage; +cvvResizeWindow := @cvResizeWindow; +cvvDestroyWindow := @cvDestroyWindow; +cvvCreateTrackbar := @cvCreateTrackbar; +cvvLoadImage := @cvLoadImage; +cvvSaveImage := @cvSaveImage; +cvvWaitKey := @cvWaitKey; +cvvConvertImage := @cvConvertImage; + +cvSetPreprocessFuncWin32 := @cvSetPreprocessFuncWin32_; +cvSetPostprocessFuncWin32 := @cvSetPostprocessFuncWin32_; +set_preprocess_func := @cvSetPreprocessFuncWin32_; +set_postprocess_func := @cvSetPostprocessFuncWin32_; + end. diff --git a/source/ocv.imgproc.types_c.pas b/source/ocv.imgproc.types_c.pas index e7831fd..33c7219 100644 --- a/source/ocv.imgproc.types_c.pas +++ b/source/ocv.imgproc.types_c.pas @@ -57,100 +57,100 @@ type pCvConnectedComp = ^TCvConnectedComp; TCvConnectedComp = record - area: Double; (* area of the connected component *) + area: Double; (* area of the connected component *) value: TCvScalar; (* average color of the connected component *) - rect: TCvRect; (* ROI of the component *) + rect: TCvRect; (* ROI of the component *) contour: ^TCvSeq; (* optional component boundary *) end; (* Image smooth methods *) const CV_BLUR_NO_SCALE = 0; - CV_BLUR = 1; - CV_GAUSSIAN = 2; - CV_MEDIAN = 3; - CV_BILATERAL = 4; + CV_BLUR = 1; + CV_GAUSSIAN = 2; + CV_MEDIAN = 3; + CV_BILATERAL = 4; (* Filters used in pyramid decomposition *) CV_GAUSSIAN_5x5 = 7; (* Special filters *) - CV_SCHARR = -1; + CV_SCHARR = -1; CV_MAX_SOBEL_KSIZE = 7; (* Constants for color conversion *) - CV_BGR2BGRA = 0; - CV_RGB2RGBA = CV_BGR2BGRA; - CV_BGRA2BGR = 1; - CV_RGBA2RGB = CV_BGRA2BGR; - CV_BGR2RGBA = 2; - CV_RGB2BGRA = CV_BGR2RGBA; - CV_RGBA2BGR = 3; - CV_BGRA2RGB = CV_RGBA2BGR; - CV_BGR2RGB = 4; - CV_RGB2BGR = CV_BGR2RGB; - CV_BGRA2RGBA = 5; - CV_RGBA2BGRA = CV_BGRA2RGBA; - CV_BGR2GRAY = 6; - CV_RGB2GRAY = 7; - CV_GRAY2BGR = 8; - CV_GRAY2RGB = CV_GRAY2BGR; - CV_GRAY2BGRA = 9; - CV_GRAY2RGBA = CV_GRAY2BGRA; - CV_BGRA2GRAY = 10; - CV_RGBA2GRAY = 11; - CV_BGR2BGR565 = 12; - CV_RGB2BGR565 = 13; - CV_BGR5652BGR = 14; - CV_BGR5652RGB = 15; - CV_BGRA2BGR565 = 16; - CV_RGBA2BGR565 = 17; - CV_BGR5652BGRA = 18; - CV_BGR5652RGBA = 19; - CV_GRAY2BGR565 = 20; - CV_BGR5652GRAY = 21; - CV_BGR2BGR555 = 22; - CV_RGB2BGR555 = 23; - CV_BGR5552BGR = 24; - CV_BGR5552RGB = 25; - CV_BGRA2BGR555 = 26; - CV_RGBA2BGR555 = 27; - CV_BGR5552BGRA = 28; - CV_BGR5552RGBA = 29; - CV_GRAY2BGR555 = 30; - CV_BGR5552GRAY = 31; - CV_BGR2XYZ = 32; - CV_RGB2XYZ = 33; - CV_XYZ2BGR = 34; - CV_XYZ2RGB = 35; - CV_BGR2YCrCb = 36; - CV_RGB2YCrCb = 37; - CV_YCrCb2BGR = 38; - CV_YCrCb2RGB = 39; - CV_BGR2HSV = 40; - CV_RGB2HSV = 41; - CV_BGR2Lab = 44; - CV_RGB2Lab = 45; - CV_BayerBG2BGR = 46; - CV_BayerGB2BGR = 47; - CV_BayerRG2BGR = 48; - CV_BayerGR2BGR = 49; - CV_BayerBG2RGB = CV_BayerRG2BGR; - CV_BayerGB2RGB = CV_BayerGR2BGR; - CV_BayerRG2RGB = CV_BayerBG2BGR; - CV_BayerGR2RGB = CV_BayerGB2BGR; - CV_BGR2Luv = 50; - CV_RGB2Luv = 51; - CV_BGR2HLS = 52; - CV_RGB2HLS = 53; - CV_HSV2BGR = 54; - CV_HSV2RGB = 55; - CV_Lab2BGR = 56; - CV_Lab2RGB = 57; - CV_Luv2BGR = 58; - CV_Luv2RGB = 59; - CV_HLS2BGR = 60; - CV_HLS2RGB = 61; + CV_BGR2BGRA = 0; + CV_RGB2RGBA = CV_BGR2BGRA; + CV_BGRA2BGR = 1; + CV_RGBA2RGB = CV_BGRA2BGR; + CV_BGR2RGBA = 2; + CV_RGB2BGRA = CV_BGR2RGBA; + CV_RGBA2BGR = 3; + CV_BGRA2RGB = CV_RGBA2BGR; + CV_BGR2RGB = 4; + CV_RGB2BGR = CV_BGR2RGB; + CV_BGRA2RGBA = 5; + CV_RGBA2BGRA = CV_BGRA2RGBA; + CV_BGR2GRAY = 6; + CV_RGB2GRAY = 7; + CV_GRAY2BGR = 8; + CV_GRAY2RGB = CV_GRAY2BGR; + CV_GRAY2BGRA = 9; + CV_GRAY2RGBA = CV_GRAY2BGRA; + CV_BGRA2GRAY = 10; + CV_RGBA2GRAY = 11; + CV_BGR2BGR565 = 12; + CV_RGB2BGR565 = 13; + CV_BGR5652BGR = 14; + CV_BGR5652RGB = 15; + CV_BGRA2BGR565 = 16; + CV_RGBA2BGR565 = 17; + CV_BGR5652BGRA = 18; + CV_BGR5652RGBA = 19; + CV_GRAY2BGR565 = 20; + CV_BGR5652GRAY = 21; + CV_BGR2BGR555 = 22; + CV_RGB2BGR555 = 23; + CV_BGR5552BGR = 24; + CV_BGR5552RGB = 25; + CV_BGRA2BGR555 = 26; + CV_RGBA2BGR555 = 27; + CV_BGR5552BGRA = 28; + CV_BGR5552RGBA = 29; + CV_GRAY2BGR555 = 30; + CV_BGR5552GRAY = 31; + CV_BGR2XYZ = 32; + CV_RGB2XYZ = 33; + CV_XYZ2BGR = 34; + CV_XYZ2RGB = 35; + CV_BGR2YCrCb = 36; + CV_RGB2YCrCb = 37; + CV_YCrCb2BGR = 38; + CV_YCrCb2RGB = 39; + CV_BGR2HSV = 40; + CV_RGB2HSV = 41; + CV_BGR2Lab = 44; + CV_RGB2Lab = 45; + CV_BayerBG2BGR = 46; + CV_BayerGB2BGR = 47; + CV_BayerRG2BGR = 48; + CV_BayerGR2BGR = 49; + CV_BayerBG2RGB = CV_BayerRG2BGR; + CV_BayerGB2RGB = CV_BayerGR2BGR; + CV_BayerRG2RGB = CV_BayerBG2BGR; + CV_BayerGR2RGB = CV_BayerGB2BGR; + CV_BGR2Luv = 50; + CV_RGB2Luv = 51; + CV_BGR2HLS = 52; + CV_RGB2HLS = 53; + CV_HSV2BGR = 54; + CV_HSV2RGB = 55; + CV_Lab2BGR = 56; + CV_Lab2RGB = 57; + CV_Luv2BGR = 58; + CV_Luv2RGB = 59; + CV_HLS2BGR = 60; + CV_HLS2RGB = 61; CV_BayerBG2BGR_VNG = 62; CV_BayerGB2BGR_VNG = 63; CV_BayerRG2BGR_VNG = 64; @@ -159,76 +159,76 @@ const CV_BayerGB2RGB_VNG = CV_BayerGR2BGR_VNG; CV_BayerRG2RGB_VNG = CV_BayerBG2BGR_VNG; CV_BayerGR2RGB_VNG = CV_BayerGB2BGR_VNG; - CV_BGR2HSV_FULL = 66; - CV_RGB2HSV_FULL = 67; - CV_BGR2HLS_FULL = 68; - CV_RGB2HLS_FULL = 69; - CV_HSV2BGR_FULL = 70; - CV_HSV2RGB_FULL = 71; - CV_HLS2BGR_FULL = 72; - CV_HLS2RGB_FULL = 73; - CV_LBGR2Lab = 74; - CV_LRGB2Lab = 75; - CV_LBGR2Luv = 76; - CV_LRGB2Luv = 77; - CV_Lab2LBGR = 78; - CV_Lab2LRGB = 79; - CV_Luv2LBGR = 80; - CV_Luv2LRGB = 81; - CV_BGR2YUV = 82; - CV_RGB2YUV = 83; - CV_YUV2BGR = 84; - CV_YUV2RGB = 85; - CV_BayerBG2GRAY = 86; - CV_BayerGB2GRAY = 87; - CV_BayerRG2GRAY = 88; - CV_BayerGR2GRAY = 89; + CV_BGR2HSV_FULL = 66; + CV_RGB2HSV_FULL = 67; + CV_BGR2HLS_FULL = 68; + CV_RGB2HLS_FULL = 69; + CV_HSV2BGR_FULL = 70; + CV_HSV2RGB_FULL = 71; + CV_HLS2BGR_FULL = 72; + CV_HLS2RGB_FULL = 73; + CV_LBGR2Lab = 74; + CV_LRGB2Lab = 75; + CV_LBGR2Luv = 76; + CV_LRGB2Luv = 77; + CV_Lab2LBGR = 78; + CV_Lab2LRGB = 79; + CV_Luv2LBGR = 80; + CV_Luv2LRGB = 81; + CV_BGR2YUV = 82; + CV_RGB2YUV = 83; + CV_YUV2BGR = 84; + CV_YUV2RGB = 85; + CV_BayerBG2GRAY = 86; + CV_BayerGB2GRAY = 87; + CV_BayerRG2GRAY = 88; + CV_BayerGR2GRAY = 89; // YUV 4:2:0 formats family; - CV_YUV2RGB_NV12 = 90; - CV_YUV2BGR_NV12 = 91; - CV_YUV2RGB_NV21 = 92; - CV_YUV2BGR_NV21 = 93; - CV_YUV420sp2RGB = CV_YUV2RGB_NV21; - CV_YUV420sp2BGR = CV_YUV2BGR_NV21; + CV_YUV2RGB_NV12 = 90; + CV_YUV2BGR_NV12 = 91; + CV_YUV2RGB_NV21 = 92; + CV_YUV2BGR_NV21 = 93; + CV_YUV420sp2RGB = CV_YUV2RGB_NV21; + CV_YUV420sp2BGR = CV_YUV2BGR_NV21; CV_YUV2RGBA_NV12 = 94; CV_YUV2BGRA_NV12 = 95; CV_YUV2RGBA_NV21 = 96; CV_YUV2BGRA_NV21 = 97; CV_YUV420sp2RGBA = CV_YUV2RGBA_NV21; CV_YUV420sp2BGRA = CV_YUV2BGRA_NV21; - CV_YUV2RGB_YV12 = 98; - CV_YUV2BGR_YV12 = 99; - CV_YUV2RGB_IYUV = 100; - CV_YUV2BGR_IYUV = 101; - CV_YUV2RGB_I420 = CV_YUV2RGB_IYUV; - CV_YUV2BGR_I420 = CV_YUV2BGR_IYUV; - CV_YUV420p2RGB = CV_YUV2RGB_YV12; - CV_YUV420p2BGR = CV_YUV2BGR_YV12; + CV_YUV2RGB_YV12 = 98; + CV_YUV2BGR_YV12 = 99; + CV_YUV2RGB_IYUV = 100; + CV_YUV2BGR_IYUV = 101; + CV_YUV2RGB_I420 = CV_YUV2RGB_IYUV; + CV_YUV2BGR_I420 = CV_YUV2BGR_IYUV; + CV_YUV420p2RGB = CV_YUV2RGB_YV12; + CV_YUV420p2BGR = CV_YUV2BGR_YV12; CV_YUV2RGBA_YV12 = 102; CV_YUV2BGRA_YV12 = 103; CV_YUV2RGBA_IYUV = 104; CV_YUV2BGRA_IYUV = 105; CV_YUV2RGBA_I420 = CV_YUV2RGBA_IYUV; CV_YUV2BGRA_I420 = CV_YUV2BGRA_IYUV; - CV_YUV420p2RGBA = CV_YUV2RGBA_YV12; - CV_YUV420p2BGRA = CV_YUV2BGRA_YV12; - CV_YUV2GRAY_420 = 106; + CV_YUV420p2RGBA = CV_YUV2RGBA_YV12; + CV_YUV420p2BGRA = CV_YUV2BGRA_YV12; + CV_YUV2GRAY_420 = 106; CV_YUV2GRAY_NV21 = CV_YUV2GRAY_420; CV_YUV2GRAY_NV12 = CV_YUV2GRAY_420; CV_YUV2GRAY_YV12 = CV_YUV2GRAY_420; CV_YUV2GRAY_IYUV = CV_YUV2GRAY_420; CV_YUV2GRAY_I420 = CV_YUV2GRAY_420; CV_YUV420sp2GRAY = CV_YUV2GRAY_420; - CV_YUV420p2GRAY = CV_YUV2GRAY_420; + CV_YUV420p2GRAY = CV_YUV2GRAY_420; // YUV 4:2:2 formats family; CV_YUV2RGB_UYVY = 107; CV_YUV2BGR_UYVY = 108; // CV_YUV2RGB_VYUY = 109; // CV_YUV2BGR_VYUY = 110; - CV_YUV2RGB_Y422 = CV_YUV2RGB_UYVY; - CV_YUV2BGR_Y422 = CV_YUV2BGR_UYVY; - CV_YUV2RGB_UYNV = CV_YUV2RGB_UYVY; - CV_YUV2BGR_UYNV = CV_YUV2BGR_UYVY; + CV_YUV2RGB_Y422 = CV_YUV2RGB_UYVY; + CV_YUV2BGR_Y422 = CV_YUV2BGR_UYVY; + CV_YUV2RGB_UYNV = CV_YUV2RGB_UYVY; + CV_YUV2BGR_UYNV = CV_YUV2BGR_UYVY; CV_YUV2RGBA_UYVY = 111; CV_YUV2BGRA_UYVY = 112; // CV_YUV2RGBA_VYUY = 113; @@ -237,14 +237,14 @@ const CV_YUV2BGRA_Y422 = CV_YUV2BGRA_UYVY; CV_YUV2RGBA_UYNV = CV_YUV2RGBA_UYVY; CV_YUV2BGRA_UYNV = CV_YUV2BGRA_UYVY; - CV_YUV2RGB_YUY2 = 115; - CV_YUV2BGR_YUY2 = 116; - CV_YUV2RGB_YVYU = 117; - CV_YUV2BGR_YVYU = 118; - CV_YUV2RGB_YUYV = CV_YUV2RGB_YUY2; - CV_YUV2BGR_YUYV = CV_YUV2BGR_YUY2; - CV_YUV2RGB_YUNV = CV_YUV2RGB_YUY2; - CV_YUV2BGR_YUNV = CV_YUV2BGR_YUY2; + CV_YUV2RGB_YUY2 = 115; + CV_YUV2BGR_YUY2 = 116; + CV_YUV2RGB_YVYU = 117; + CV_YUV2BGR_YVYU = 118; + CV_YUV2RGB_YUYV = CV_YUV2RGB_YUY2; + CV_YUV2BGR_YUYV = CV_YUV2BGR_YUY2; + CV_YUV2RGB_YUNV = CV_YUV2RGB_YUY2; + CV_YUV2BGR_YUNV = CV_YUV2BGR_YUY2; CV_YUV2RGBA_YUY2 = 119; CV_YUV2BGRA_YUY2 = 120; CV_YUV2RGBA_YVYU = 121; @@ -262,34 +262,34 @@ const CV_YUV2GRAY_YUYV = CV_YUV2GRAY_YUY2; CV_YUV2GRAY_YUNV = CV_YUV2GRAY_YUY2; // alpha premultiplication; - CV_RGBA2mRGBA = 125; - CV_mRGBA2RGBA = 126; + CV_RGBA2mRGBA = 125; + CV_mRGBA2RGBA = 126; CV_COLORCVT_MAX = 127; (* Sub-pixel interpolation methods *) - CV_INTER_NN = 0; - CV_INTER_LINEAR = 1; - CV_INTER_CUBIC = 2; - CV_INTER_AREA = 3; + CV_INTER_NN = 0; + CV_INTER_LINEAR = 1; + CV_INTER_CUBIC = 2; + CV_INTER_AREA = 3; CV_INTER_LANCZOS4 = 4; (* ... and other image warping flags *) CV_WARP_FILL_OUTLIERS = 8; - CV_WARP_INVERSE_MAP = 16; + CV_WARP_INVERSE_MAP = 16; (* Shapes of a structuring element for morphological operations *) - CV_SHAPE_RECT = 0; - CV_SHAPE_CROSS = 1; + CV_SHAPE_RECT = 0; + CV_SHAPE_CROSS = 1; CV_SHAPE_ELLIPSE = 2; - CV_SHAPE_CUSTOM = 100; + CV_SHAPE_CUSTOM = 100; (* Morphological operations *) - CV_MOP_ERODE = 0; - CV_MOP_DILATE = 1; - CV_MOP_OPEN = 2; - CV_MOP_CLOSE = 3; + CV_MOP_ERODE = 0; + CV_MOP_DILATE = 1; + CV_MOP_OPEN = 2; + CV_MOP_CLOSE = 3; CV_MOP_GRADIENT = 4; - CV_MOP_TOPHAT = 5; + CV_MOP_TOPHAT = 5; CV_MOP_BLACKHAT = 6; (* Spatial and central moments *) @@ -312,11 +312,11 @@ type (* Template matching methods *) const - CV_TM_SQDIFF = 0; + CV_TM_SQDIFF = 0; CV_TM_SQDIFF_NORMED = 1; - CV_TM_CCORR = 2; - CV_TM_CCORR_NORMED = 3; - CV_TM_CCOEFF = 4; + CV_TM_CCORR = 2; + CV_TM_CCORR_NORMED = 3; + CV_TM_CCOEFF = 4; CV_TM_CCOEFF_NORMED = 5; type @@ -324,18 +324,18 @@ type const (* Contour retrieval modes *) - CV_RETR_EXTERNAL = 0; - CV_RETR_LIST = 1; - CV_RETR_CCOMP = 2; - CV_RETR_TREE = 3; + CV_RETR_EXTERNAL = 0; + CV_RETR_LIST = 1; + CV_RETR_CCOMP = 2; + CV_RETR_TREE = 3; CV_RETR_FLOODFILL = 4; (* Contour approximation methods *) - CV_CHAIN_CODE = 0; - CV_CHAIN_APPROX_NONE = 1; - CV_CHAIN_APPROX_SIMPLE = 2; - CV_CHAIN_APPROX_TC89_L1 = 3; + CV_CHAIN_CODE = 0; + CV_CHAIN_APPROX_NONE = 1; + CV_CHAIN_APPROX_SIMPLE = 2; + CV_CHAIN_APPROX_TC89_L1 = 3; CV_CHAIN_APPROX_TC89_KCOS = 4; - CV_LINK_RUNS = 5; + CV_LINK_RUNS = 5; (* Internal structure that is used for sequental retrieving contours from the image. @@ -399,20 +399,20 @@ Type // --CV_SET_FIELDS() // --CV_SEQUENCE_FIELDS() // ---CV_TREE_NODE_FIELDS(CvSeq); - flags: Integer; // * Miscellaneous flags. - eader_size: Integer; // * Size of sequence header. - h_prev: pCvSeq; // * Previous sequence. - h_next: pCvSeq; // * Next sequence. - v_prev: pCvSeq; // * 2nd previous sequence. - v_next: pCvSeq; // * 2nd next sequence. - total: Integer; // * Total number of elements. - elem_size: Integer; // * Size of sequence element in bytes. - block_max: pShortInt; // * Maximal bound of the last block. - ptr: pShortInt; // * Current write pointer. - delta_elems: Integer; // * Grow seq this many at a time. - storage: pCvMemStorage; // * Where the seq is stored. + flags: Integer; // * Miscellaneous flags. + eader_size: Integer; // * Size of sequence header. + h_prev: pCvSeq; // * Previous sequence. + h_next: pCvSeq; // * Next sequence. + v_prev: pCvSeq; // * 2nd previous sequence. + v_next: pCvSeq; // * 2nd next sequence. + total: Integer; // * Total number of elements. + elem_size: Integer; // * Size of sequence element in bytes. + block_max: pShortInt; // * Maximal bound of the last block. + ptr: pShortInt; // * Current write pointer. + delta_elems: Integer; // * Grow seq this many at a time. + storage: pCvMemStorage; // * Where the seq is stored. free_blocks: pCvSeqBlock; // * Free blocks list. - first: pCvSeqBlock; // * Pointer to the first sequence block. + first: pCvSeqBlock; // * Pointer to the first sequence block. free_elems: pCvSetElem; active_count: Integer; edges: pCvSet; @@ -425,20 +425,20 @@ Type const // Type CvSubdiv2DPointLocation - CV_PTLOC_ERROR = -2; + CV_PTLOC_ERROR = -2; CV_PTLOC_OUTSIDE_RECT = -1; - CV_PTLOC_INSIDE = 0; - CV_PTLOC_VERTEX = 1; - CV_PTLOC_ON_EDGE = 2; + CV_PTLOC_INSIDE = 0; + CV_PTLOC_VERTEX = 1; + CV_PTLOC_ON_EDGE = 2; // Type CvNextEdgeType - CV_NEXT_AROUND_ORG = $00; - CV_NEXT_AROUND_DST = $22; - CV_PREV_AROUND_ORG = $11; - CV_PREV_AROUND_DST = $33; - CV_NEXT_AROUND_LEFT = $13; + CV_NEXT_AROUND_ORG = $00; + CV_NEXT_AROUND_DST = $22; + CV_PREV_AROUND_ORG = $11; + CV_PREV_AROUND_DST = $33; + CV_NEXT_AROUND_LEFT = $13; CV_NEXT_AROUND_RIGHT = $31; - CV_PREV_AROUND_LEFT = $20; + CV_PREV_AROUND_LEFT = $20; CV_PREV_AROUND_RIGHT = $02; (* get the next edge with the same origin point (counterwise) *) @@ -452,7 +452,7 @@ const CV_CONTOURS_MATCH_I2 = 2; CV_CONTOURS_MATCH_I3 = 3; (* Shape orientation *) - CV_CLOCKWISE = 1; + CV_CLOCKWISE = 1; CV_COUNTER_CLOCKWISE = 2; (* Convexity defect *) @@ -460,10 +460,10 @@ type pCvConvexityDefect = ^TCvConvexityDefect; TCvConvexityDefect = record - start: PCvPoint; (* point of the contour where the defect begins *) - _end: PCvPoint; (* point of the contour where the defect ends *) + start: PCvPoint; (* point of the contour where the defect begins *) + _end: PCvPoint; (* point of the contour where the defect ends *) depth_point: PCvPoint; (* the farthest from the convex hull point within the defect *) - depth: Single; (* distance between the farthest point and the convex hull *) + depth: Single; (* distance between the farthest point and the convex hull *) end; (* Histogram comparison methods *) @@ -526,11 +526,9 @@ const CV_THRESH_OTSU = 8; (* use Otsu algorithm to choose the optimal threshold value; - combine = the flag with one of the above CV_THRESH_* values; - {$EXTERNALSYM combine} - - - (* Adaptive threshold methods *) + combine = the flag with one of the above CV_THRESH_* values; *) +//{$EXTERNALSYM combine} + (* Adaptive threshold methods *) CV_ADAPTIVE_THRESH_MEAN_C = 0; CV_ADAPTIVE_THRESH_GAUSSIAN_C = 1; diff --git a/source/ocv.imgproc_c.pas b/source/ocv.imgproc_c.pas index bb4dc24..8a0ab03 100644 --- a/source/ocv.imgproc_c.pas +++ b/source/ocv.imgproc_c.pas @@ -132,8 +132,7 @@ procedure cvSmooth( CvPoint anchor CV_DEFAULT(cvPoint(-1,-1))); *) -procedure cvFilter2D(const src: PCvArr; dst: PCvArr; const kernel: pCvMat; anchor: TCvPoint { =CV_DEFAULT(cvPoint(-1,-1)) } ); - cdecl; overload; +procedure cvFilter2D(const src: PCvArr; dst: PCvArr; const kernel: pCvMat; anchor: TCvPoint { =CV_DEFAULT(cvPoint(-1,-1)) } ); cdecl; overload; procedure cvFilter2D(const src: PCvArr; dst: PCvArr; const kernel: pCvMat); overload; { @@ -181,8 +180,8 @@ procedure cvPyrUp(const src: PCvArr; dst: PCvArr; filter: Integer = CV_GAUSSIAN_ int calc CV_DEFAULT(1), int filter CV_DEFAULT(CV_GAUSSIAN_5x5) ); *) -function cvCreatePyramid(const img: PCvArr; extra_layers: Integer; rate: Double; const layer_sizes: pCvSize = nil; bufarr: PCvArr = nil; - calc: Integer = 1; filter: Integer = CV_GAUSSIAN_5x5): ppCvMat; cdecl; +function cvCreatePyramid(const img: PCvArr; extra_layers: Integer; rate: Double; const layer_sizes: pCvSize = nil; bufarr: PCvArr = nil; calc: Integer = 1; + filter: Integer = CV_GAUSSIAN_5x5): ppCvMat; cdecl; (* Releases pyramid @@ -271,8 +270,8 @@ function cv2DRotationMatrix(center: TCvPoint2D32f; angle: Double; scale: Double; int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS), CvScalar fillval CV_DEFAULT(cvScalarAll(0)) ); } -procedure cvWarpPerspective(const src: PCvArr; dst: PCvArr; const map_matrix: pCvMat; - flags: Integer { =CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS }; fillval: TCvScalar { =cvScalarAll(0) } ); cdecl; +procedure cvWarpPerspective(const src: PCvArr; dst: PCvArr; const map_matrix: pCvMat; flags: Integer { =CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS }; + fillval: TCvScalar { =cvScalarAll(0) } ); cdecl; { /* Computes perspective transform matrix for mapping src[i] to dst[i] (i=0,1,2,3) */ CVAPI(CvMat*) cvGetPerspectiveTransform( const CvPoint2D32f* src, @@ -291,8 +290,8 @@ function cvGetPerspectiveTransform(const src: pCvPoint2D32f; const dst: pCvPoint int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS), CvScalar fillval CV_DEFAULT(cvScalarAll(0)) ); } -procedure cvRemap(const src: PCvArr; dst: PCvArr; const mapx: PCvArr; const mapy: PCvArr; - flags: Integer { =CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS }; fillval: TCvScalar { =cvScalarAll(0) } +procedure cvRemap(const src: PCvArr; dst: PCvArr; const mapx: PCvArr; const mapy: PCvArr; flags: Integer { =CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS }; + fillval: TCvScalar { =cvScalarAll(0) } ); cdecl; (* @@ -306,8 +305,7 @@ procedure cvConvertMaps(const mapx: PCvArr; const mapy: PCvArr; mapxy: PCvArr; m // CVAPI(void) cvLogPolar( const CvArr* src, CvArr* dst, // CvPoint2D32f center, double M, // int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS)); -procedure cvLogPolar(const src: PCvArr; dst: PCvArr; center: TCvPoint2D32f; M: Double; - flags: Integer = CV_INTER_LINEAR + CV_WARP_FILL_OUTLIERS); cdecl; +procedure cvLogPolar(const src: PCvArr; dst: PCvArr; center: TCvPoint2D32f; M: Double; flags: Integer = CV_INTER_LINEAR + CV_WARP_FILL_OUTLIERS); cdecl; /// * Performs forward or inverse linear-polar image transform */ // CVAPI(void) cvLinearPolar( const CvArr* src, CvArr* dst, @@ -344,8 +342,8 @@ procedure cvInitUndistortMap(const camera_matrix: pCvMat; const distortion_coeff CvArr* mapx, CvArr* mapy ); *) -procedure cvInitUndistortRectifyMap(const camera_matrix: pCvMat; const dist_coeffs: pCvMat; const R: pCvMat; - const new_camera_matrix: pCvMat; mapx: PCvArr; mapy: PCvArr); cdecl; +procedure cvInitUndistortRectifyMap(const camera_matrix: pCvMat; const dist_coeffs: pCvMat; const R: pCvMat; const new_camera_matrix: pCvMat; mapx: PCvArr; + mapy: PCvArr); cdecl; (* /* Computes the original (undistorted) feature coordinates @@ -364,8 +362,8 @@ procedure cvUndistortPoints(const src: pCvMat; dst: pCvMat; const camera_matrix: // CVAPI(IplConvKernel*) cvCreateStructuringElementEx( // int cols, int rows, int anchor_x, int anchor_y, // int shape, int* values CV_DEFAULT(NULL) ); -function cvCreateStructuringElementEx(cols: Integer; rows: Integer; anchor_x: Integer; anchor_y: Integer; shape: Integer; - values: PInteger = nil): pIplConvKernel; cdecl; +function cvCreateStructuringElementEx(cols: Integer; rows: Integer; anchor_x: Integer; anchor_y: Integer; shape: Integer; values: PInteger = nil) + : pIplConvKernel; cdecl; // (* releases structuring element *) // CVAPI(procedure) cvReleaseStructuringElement( element: array of IplConvKernel); @@ -396,8 +394,7 @@ procedure cvDilate(const src: PCvArr; dst: PCvArr; element: pIplConvKernel = nil CvArr* temp, IplConvKernel* element, int operation, int iterations CV_DEFAULT(1) ); *) -procedure cvMorphologyEx(const src: PCvArr; dst: PCvArr; temp: PCvArr; element: pIplConvKernel; operation: Integer; - iterations: Integer = 1); cdecl; +procedure cvMorphologyEx(const src: PCvArr; dst: PCvArr; temp: PCvArr; element: pIplConvKernel; operation: Integer; iterations: Integer = 1); cdecl; (* /* Calculates all spatial and central moments up to the 3rd order */ @@ -477,17 +474,17 @@ function cvCalcEMD2(const signature1: PCvArr; const signature2: PCvArr; distance const // * contour retrieval mode */ CV_RETR_EXTERNAL = 0; - CV_RETR_LIST = 1; - CV_RETR_CCOMP = 2; - CV_RETR_TREE = 3; + CV_RETR_LIST = 1; + CV_RETR_CCOMP = 2; + CV_RETR_TREE = 3; // * contour approximation method */ - CV_CHAIN_CODE = 0; - CV_CHAIN_APPROX_NONE = 1; - CV_CHAIN_APPROX_SIMPLE = 2; - CV_CHAIN_APPROX_TC89_L1 = 3; + CV_CHAIN_CODE = 0; + CV_CHAIN_APPROX_NONE = 1; + CV_CHAIN_APPROX_SIMPLE = 2; + CV_CHAIN_APPROX_TC89_L1 = 3; CV_CHAIN_APPROX_TC89_KCOS = 4; - CV_LINK_RUNS = 5; + CV_LINK_RUNS = 5; type @@ -495,12 +492,12 @@ type TCvContourInfo = record flags: Integer; - next: pCvContourInfo; // next contour with the same mark value */ + next: pCvContourInfo; // next contour with the same mark value */ parent: pCvContourInfo; // information about parent contour */ - contour: pCvSeq; // corresponding contour (may be 0, if rejected) */ - rect: TCvRect; // bounding rectangle */ - origin: TCvPoint; // origin point (where the contour was traced from) */ - is_hole: Integer; // hole flag */ + contour: pCvSeq; // corresponding contour (may be 0, if rejected) */ + rect: TCvRect; // bounding rectangle */ + origin: TCvPoint; // origin point (where the contour was traced from) */ + is_hole: Integer; // hole flag */ end; (* @@ -514,25 +511,25 @@ type storage2: pCvMemStorage; // contains approximated contours // (! = storage1 if approx_method2 ! = approx_method1) * / cinfo_storage: pCvMemStorage; // contains _CvContourInfo nodes */ - cinfo_set: pCvSet; // set of _CvContourInfo nodes */ + cinfo_set: pCvSet; // set of _CvContourInfo nodes */ initial_pos: TCvMemStoragePos; // starting storage pos */ - backup_pos: TCvMemStoragePos; // beginning of the latest approx. contour */ + backup_pos: TCvMemStoragePos; // beginning of the latest approx. contour */ backup_pos2: TCvMemStoragePos; // ending of the latest approx. contour */ - img0: pByte; // image origin */ - img: pByte; // current image row */ - img_step: Integer; // image step */ - img_size: TCvSize; // ROI size */ - offset: TCvPoint; // ROI offset: coordinates, added to each contour point */ - pt: TCvPoint; // current scanner position */ - lnbd: TCvPoint; // position of the last met contour */ - nbd: Integer; // current mark val */ - l_cinfo: pCvContourInfo; // information about latest approx. contour */ - cinfo_temp: TCvContourInfo; // temporary var which is used in simple modes */ - frame_info: TCvContourInfo; // information about frame */ - frame: TCvSeq; // frame itself */ - approx_method1: Integer; // approx method when tracing */ - approx_method2: Integer; // final approx method */ - mode: Integer; // contour scanning mode: + img0: pByte; // image origin */ + img: pByte; // current image row */ + img_step: Integer; // image step */ + img_size: TCvSize; // ROI size */ + offset: TCvPoint; // ROI offset: coordinates, added to each contour point */ + pt: TCvPoint; // current scanner position */ + lnbd: TCvPoint; // position of the last met contour */ + nbd: Integer; // current mark val */ + l_cinfo: pCvContourInfo; // information about latest approx. contour */ + cinfo_temp: TCvContourInfo; // temporary var which is used in simple modes */ + frame_info: TCvContourInfo; // information about frame */ + frame: TCvSeq; // frame itself */ + approx_method1: Integer; // approx method when tracing */ + approx_method2: Integer; // final approx method */ + mode: Integer; // contour scanning mode: // 0 - external only // 1 - all the contours w/o any hierarchy // 2 - connected components (i.e. two-level structure - @@ -540,12 +537,12 @@ type // 3 - full hierarchy; // 4 - connected components of a multi-level image subst_flag: Integer; - seq_type1: Integer; // type of fetched contours */ + seq_type1: Integer; // type of fetched contours */ header_size1: Integer; // hdr size of fetched contours */ - elem_size1: Integer; // elem size of fetched contours */ - seq_type2: Integer; // */ + elem_size1: Integer; // elem size of fetched contours */ + seq_type2: Integer; // */ header_size2: Integer; // the same for approx. contours */ - elem_size2: Integer; // */ + elem_size2: Integer; // */ cinfo_table: array [0 .. 127] of pCvContourInfo; end; @@ -581,9 +578,8 @@ function cvFindContours( // int mode CV_DEFAULT(CV_RETR_LIST), // int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE), // CvPoint offset CV_DEFAULT(cvPoint(0,0))); -function cvStartFindContours(image: PCvArr; storage: pCvMemStorage; header_size: Integer { =sizeof(TCvContour)) }; - mode: Integer { = CV_RETR_LIST }; method: Integer { =CV_CHAIN_APPROX_SIMPLE }; offset: TCvPoint { =cvPoint(0,0) } ) - : pCvContourScanner; cdecl; +function cvStartFindContours(image: PCvArr; storage: pCvMemStorage; header_size: Integer { =sizeof(TCvContour)) }; mode: Integer { = CV_RETR_LIST }; + method: Integer { =CV_CHAIN_APPROX_SIMPLE }; offset: TCvPoint { =cvPoint(0,0) } ): pCvContourScanner; cdecl; // * Retrieves next contour */ // CVAPI(CvSeq*) cvFindNextContour( CvContourScanner scanner ); @@ -694,8 +690,7 @@ function cvMatchShapes(const object1: Pointer; const object2: Pointer; method: I int orientation CV_DEFAULT(CV_CLOCKWISE), int return_points CV_DEFAULT(0)); } -function cvConvexHull2(const input: pCvSeq; hull_storage: Pointer = nil; orientation: Integer = CV_CLOCKWISE; return_points: Integer = 0) - : pCvSeq; cdecl; +function cvConvexHull2(const input: pCvSeq; hull_storage: Pointer = nil; orientation: Integer = CV_CLOCKWISE; return_points: Integer = 0): pCvSeq; cdecl; { /* Checks whether the contour is convex or not (returns 1 if convex, 0 if not) */ @@ -777,8 +772,8 @@ procedure cvSetHistBinRanges(hist: pCvHistogram; ranges: pSingle; uniform: Integ float* data, float** ranges CV_DEFAULT(NULL), int uniform CV_DEFAULT(1)); *) -function cvMakeHistHeaderForArray(dims: Integer; sizes: PInteger; hist: pCvHistogram; data: pfloat; ranges: ppfloat = nil; - uniform: Integer = 1): pCvHistogram; cdecl; +function cvMakeHistHeaderForArray(dims: Integer; sizes: PInteger; hist: pCvHistogram; data: pfloat; ranges: ppfloat = nil; uniform: Integer = 1) + : pCvHistogram; cdecl; // * Releases histogram */ // CVAPI(void) cvReleaseHist( CvHistogram** hist ); @@ -795,8 +790,7 @@ procedure cvClearHist(hist: pCvHistogram); cdecl; int* min_idx CV_DEFAULT(NULL), int* max_idx CV_DEFAULT(NULL)); } -procedure cvGetMinMaxHistValue(const hist: pCvHistogram; min_value: pSingle; max_value: pSingle; min_idx: PInteger = nil; - max_idx: PInteger = nil); cdecl; +procedure cvGetMinMaxHistValue(const hist: pCvHistogram; min_value: pSingle; max_value: pSingle; min_idx: PInteger = nil; max_idx: PInteger = nil); cdecl; (* /* Normalizes histogram by dividing all bins by sum of the bins, multiplied by <factor>. @@ -833,6 +827,14 @@ procedure cvCopyHist(const src: pCvHistogram; Var dst: pCvHistogram); cdecl; *) procedure cvCalcBayesianProb(Var src: pCvHistogram; number: Integer; Var dst: pCvHistogram); cdecl; +// * Does some sort of template matching but compares histograms of +// template and each window location */ +// CVAPI(void) cvCalcArrBackProjectPatch( CvArr** image, CvArr* dst, CvSize range, +// CvHistogram* hist, int method, +// double factor ); +//procedure cvCalcArrBackProjectPatch(var image: PCvArr; dst: PCvArr; range: TCvSize; hist: pCvHistogram; method: Integer; factor: Double); cdecl; +// #define cvCalcBackProjectPatch( image, dst, range, hist, method, factor ) cvCalcArrBackProjectPatch( (CvArr**)image, dst, range, hist, method, factor ) + (* /* Calculates array histogram */ CVAPI(void) cvCalcArrHist( CvArr** arr, CvHistogram* hist, @@ -896,8 +898,8 @@ procedure cvEqualizeHist(const src, dst: PCvArr); cdecl; int labelType CV_DEFAULT(CV_DIST_LABEL_CCOMP)); } -procedure cvDistTransform(const src: PCvArr; dst: PCvArr; distance_type: Integer = CV_DIST_L2; mask_size: Integer = 3; - const mask: pfloat = nil; labels: PCvArr = nil; labelType: Integer = CV_DIST_LABEL_CCOMP); cdecl; +procedure cvDistTransform(const src: PCvArr; dst: PCvArr; distance_type: Integer = CV_DIST_L2; mask_size: Integer = 3; const mask: pfloat = nil; + labels: PCvArr = nil; labelType: Integer = CV_DIST_LABEL_CCOMP); cdecl; // (* Applies fixed-level threshold to grayscale image. // This is a basic operation applied before retrieving contours *) @@ -994,8 +996,7 @@ procedure cvCornerMinEigenVal(const image: PCvArr; eigenval: PCvArr; block_size: int block_size, int aperture_size CV_DEFAULT(3), double k CV_DEFAULT(0.04) ); *) -procedure cvCornerHarris(const image: PCvArr; harris_response: PCvArr; block_size: Integer; aperture_size: Integer = 3; - k: Double = 0.04); cdecl; +procedure cvCornerHarris(const image: PCvArr; harris_response: PCvArr; block_size: Integer; aperture_size: Integer = 3; k: Double = 0.04); cdecl; { /* Adjust corner position using some sort of gradient search */ @@ -1007,8 +1008,7 @@ procedure cvCornerHarris(const image: PCvArr; harris_response: PCvArr; block_siz CvSize zero_zone, CvTermCriteria criteria ); } -procedure cvFindCornerSubPix(const image: PCvArr; corners: pCvPoint2D32f; count: Integer; win: TCvSize; zero_zone: TCvSize; - criteria: TCvTermCriteria); cdecl; +procedure cvFindCornerSubPix(const image: PCvArr; corners: pCvPoint2D32f; count: Integer; win: TCvSize; zero_zone: TCvSize; criteria: TCvTermCriteria); cdecl; { /* Finds a sparse set of points within the selected region @@ -1023,8 +1023,7 @@ procedure cvFindCornerSubPix(const image: PCvArr; corners: pCvPoint2D32f; count: double k CV_DEFAULT(0.04) ); } procedure cvGoodFeaturesToTrack(const image: PCvArr; eig_image: PCvArr; temp_image: PCvArr; corners: pCvPoint2D32f; corner_count: PInteger; - quality_level: Double; min_distance: Double; const mask: PCvArr = nil; block_size: Integer = 3; use_harris: Integer = 0; - k: Double = 0.04); cdecl; + quality_level: Double; min_distance: Double; const mask: PCvArr = nil; block_size: Integer = 3; use_harris: Integer = 0; k: Double = 0.04); cdecl; { /* Finds lines on binary image using one of several methods. @@ -1093,53 +1092,69 @@ implementation uses ocv.lib; // procedure cvCvtColor(const src: pIplImage; dst: pIplImage; code: Integer); external imgproc_lib; -procedure cvCvtColor(const src: PCvArr; dst: PCvArr; code: Integer); external imgproc_lib name 'cvCvtColor'; -procedure cvCvtColor(const src: pCvMat; dst: pCvMat; code: Integer); external imgproc_lib name 'cvCvtColor'; +procedure cvCvtColor(const src: PCvArr; dst: PCvArr; code: Integer); cdecl; external imgproc_lib name 'cvCvtColor'; +procedure cvCvtColor(const src: pCvMat; dst: pCvMat; code: Integer); cdecl; external imgproc_lib name 'cvCvtColor'; // procedure cvCvtColor(const src: PCvArr; dst: pCvMat; code: Integer); external imgproc_lib name 'cvCvtColor'; -function cvThreshold; external imgproc_lib; -procedure cvSmooth; external imgproc_lib; -procedure cvResize; external imgproc_lib; -function cvCreateStructuringElementEx; external imgproc_lib; -procedure cvErode; external imgproc_lib; -procedure cvDilate; external imgproc_lib; -procedure cvReleaseStructuringElement; external imgproc_lib; -procedure cvMorphologyEx; external imgproc_lib; -procedure cvFloodFill; external imgproc_lib; -procedure cvAdaptiveThreshold; external imgproc_lib; -procedure cvCopyMakeBorder; external imgproc_lib; -procedure cvSobel; external imgproc_lib; -procedure cvLaplace; external imgproc_lib; -procedure cvCanny; external imgproc_lib; -function cvHoughLines2; external imgproc_lib; -function cvHoughCircles; external imgproc_lib; -procedure cvIntegral; external imgproc_lib; -function cvFindContours; external imgproc_lib; -function cvApproxPoly; external imgproc_lib; -procedure cvEqualizeHist; external imgproc_lib; -procedure cvFindCornerSubPix; external imgproc_lib; -procedure cvInitUndistortMap; external imgproc_lib; -procedure cvRemap; external imgproc_lib; -function cvArcLength; external imgproc_lib; +function cvThreshold(const src, dst: PCvArr; threshold, max_value: Double; threshold_type: Integer): Double; cdecl; external imgproc_lib; +procedure cvSmooth(const src: PCvArr; dst: PCvArr; smoothtype: Integer = CV_GAUSSIAN; size1: Integer = 3; size2: Integer = 0; sigma1: Double = 0; + sigma2: Double = 0); cdecl; external imgproc_lib; +procedure cvResize(const src: PCvArr; dst: PCvArr; interpolation: Integer = CV_INTER_LINEAR); cdecl; external imgproc_lib; +function cvCreateStructuringElementEx(cols: Integer; rows: Integer; anchor_x: Integer; anchor_y: Integer; shape: Integer; values: PInteger = nil) + : pIplConvKernel; cdecl; external imgproc_lib; +procedure cvErode(const src: PCvArr; dst: PCvArr; element: pIplConvKernel = nil; iterations: Integer = 1); cdecl; external imgproc_lib; +procedure cvDilate(const src: PCvArr; dst: PCvArr; element: pIplConvKernel = nil; iterations: Integer = 1); cdecl; external imgproc_lib; +procedure cvReleaseStructuringElement(Var element: pIplConvKernel); cdecl; external imgproc_lib; +procedure cvMorphologyEx(const src: PCvArr; dst: PCvArr; temp: PCvArr; element: pIplConvKernel; operation: Integer; iterations: Integer = 1); cdecl; + external imgproc_lib; +procedure cvFloodFill(image: PCvArr; seed_point: TCvPoint; new_val: TCvScalar; lo_diff: TCvScalar { * cvScalarAll(0) * }; + up_diff: TCvScalar { * cvScalarAll(0) * }; comp: pCvConnectedComp = NIL; flags: Integer = 4; mask: PCvArr = NIL); cdecl; external imgproc_lib; +procedure cvAdaptiveThreshold(const src: PCvArr; dst: PCvArr; max_value: Double; adaptive_method: Integer = CV_ADAPTIVE_THRESH_MEAN_C; + threshold_type: Integer = CV_THRESH_BINARY; block_size: Integer = 3; param1: Double = 5); cdecl; external imgproc_lib; +procedure cvCopyMakeBorder(const src: PCvArr; dst: PCvArr; offset: TCvPoint; bordertype: Integer; value: TCvScalar { * cvScalarAll(0) * } ); cdecl; + external imgproc_lib; +procedure cvSobel(const src: PCvArr; dst: PCvArr; xorder: Integer; yorder: Integer; aperture_size: Integer = 3); cdecl; external imgproc_lib; +procedure cvLaplace(const src: PCvArr; dst: PCvArr; aperture_size: Integer = 3); cdecl; external imgproc_lib; +procedure cvCanny(const image: PCvArr; edges: PCvArr; threshold1: Double; threshold2: Double; aperture_size: Integer = 3); cdecl; external imgproc_lib; +function cvHoughLines2(image: PCvArr; line_storage: Pointer; method: Integer; rho: Double; theta: Double; threshold: Integer; param1: Double = 0; + param2: Double = 0): pCvSeq; cdecl; external imgproc_lib; +function cvHoughCircles(image: PCvArr; circle_storage: Pointer; method: Integer; dp: Double; min_dist: Double; param1: Double = 100; param2: Double = 100; + min_radius: Integer = 0; max_radius: Integer = 0): pCvSeq; cdecl; external imgproc_lib; +procedure cvIntegral(const image: PCvArr; sum: PCvArr; sqsum: PCvArr = NIL; tilted_sum: PCvArr = NIL); cdecl; external imgproc_lib; +function cvFindContours(image: PCvArr; storage: pCvMemStorage; first_contour: pCvSeq; header_size: Integer { = SizeOf(TCvContour) }; + mode: Integer { = CV_RETR_LIST }; method: Integer { = CV_CHAIN_APPROX_SIMPLE }; offset: TCvPoint { =cvPoint(0,0) } ): Integer; cdecl; external imgproc_lib; +function cvApproxPoly(const src_seq: pCvSeq; header_size: Integer; storage: pCvMemStorage; method: Integer; eps: Double; recursive: Integer = 0): pCvSeq; cdecl; + external imgproc_lib; +procedure cvEqualizeHist(const src, dst: PCvArr); cdecl; external imgproc_lib; +procedure cvFindCornerSubPix(const image: PCvArr; corners: pCvPoint2D32f; count: Integer; win: TCvSize; zero_zone: TCvSize; criteria: TCvTermCriteria); cdecl; + external imgproc_lib; +procedure cvInitUndistortMap(const camera_matrix: pCvMat; const distortion_coeffs: pCvMat; mapx: PCvArr; mapy: PCvArr); cdecl; external imgproc_lib; +procedure cvRemap(const src: PCvArr; dst: PCvArr; const mapx: PCvArr; const mapy: PCvArr; flags: Integer { =CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS }; + fillval: TCvScalar { =cvScalarAll(0) } + ); cdecl; external imgproc_lib; +function cvArcLength(const curve: Pointer; slice: TCvSlice { = CV_WHOLE_SEQ }; is_closed: Integer { = 1 } ): Double; cdecl; external imgproc_lib; function cvContourPerimeter(const contour: Pointer): Double; {$IFDEF USE_INLINE}inline; {$ENDIF} begin result := cvArcLength(contour, CV_WHOLE_SEQ, 1); end; -function cvMatchShapes; external imgproc_lib; -function cv2DRotationMatrix; external imgproc_lib; -procedure cvWarpAffine; external imgproc_lib; -function cvGetPerspectiveTransform; external imgproc_lib; -procedure cvWarpPerspective; external imgproc_lib; -function cvBoundingRect; external imgproc_lib; -function cvContourArea; external imgproc_lib; -function cvConvexHull2; external imgproc_lib; -function cvConvexityDefects; external imgproc_lib; -procedure cvPyrDown; external imgproc_lib; -procedure cvPyrUp; external imgproc_lib; -function cvCheckContourConvexity; external imgproc_lib; -function cvCreateHist; external imgproc_lib; +function cvMatchShapes(const object1: Pointer; const object2: Pointer; method: Integer; parameter: Double = 0): Double; cdecl; external imgproc_lib; +function cv2DRotationMatrix(center: TCvPoint2D32f; angle: Double; scale: Double; map_matrix: pCvMat): pCvMat; cdecl; external imgproc_lib; +procedure cvWarpAffine(const src: PCvArr; dst: PCvArr; const map_matrix: pCvMat; flags: Integer { = CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS }; + fillval: TCvScalar { = cvScalarAll(0) } ); cdecl; external imgproc_lib; +function cvGetPerspectiveTransform(const src: pCvPoint2D32f; const dst: pCvPoint2D32f; map_matrix: pCvMat): pCvMat; cdecl; external imgproc_lib; +procedure cvWarpPerspective(const src: PCvArr; dst: PCvArr; const map_matrix: pCvMat; flags: Integer { =CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS }; + fillval: TCvScalar { =cvScalarAll(0) } ); cdecl; external imgproc_lib; +function cvBoundingRect(points: PCvArr; update: Integer = 0): TCvRect; cdecl; external imgproc_lib; +function cvContourArea(const contour: PCvArr; slice: TCvSlice { = CV_WHOLE_SEQ }; oriented: Integer = 0): Double; cdecl; external imgproc_lib; +function cvConvexHull2(const input: pCvSeq; hull_storage: Pointer = nil; orientation: Integer = CV_CLOCKWISE; return_points: Integer = 0): pCvSeq; cdecl; + external imgproc_lib; +function cvConvexityDefects(contour: pCvSeq; convexhull: pCvSeq; storage: pCvMemStorage = nil): pCvSeq; cdecl; external imgproc_lib; +procedure cvPyrDown(const src: PCvArr; dst: PCvArr; filter: Integer = CV_GAUSSIAN_5x5); cdecl; external imgproc_lib; +procedure cvPyrUp(const src: PCvArr; dst: PCvArr; filter: Integer = CV_GAUSSIAN_5x5); cdecl; external imgproc_lib; +function cvCheckContourConvexity(const contour: pCvSeq): Integer; cdecl; external imgproc_lib; +function cvCreateHist(dims: Integer; sizes: PInteger; _type: Integer; ranges: Pointer = nil; uniform: Integer = 1): pCvHistogram; cdecl; external imgproc_lib; procedure cvCalcHist(var image: PCvArr; hist: pCvHistogram; accumulate: Integer = 0; const mask: PCvArr = nil); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; @@ -1150,13 +1165,13 @@ end; procedure cvCalcHist(var image: pIplImage; hist: pCvHistogram; accumulate: Integer = 0; const mask: PCvArr = nil); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; begin - cvCalcArrHist(image, hist, accumulate, mask); + cvCalcArrHist(PCvArr(image), hist, accumulate, mask); end; procedure cvCalcHist(var image: pCvMat; hist: pCvHistogram; accumulate: Integer = 0; const mask: PCvArr = nil); {$IFDEF USE_INLINE}inline; {$ENDIF} overload; begin - cvCalcArrHist(image, hist, accumulate, mask); + cvCalcArrHist(PCvArr(image), hist, accumulate, mask); end; // procedure cvCalcHist; @@ -1164,87 +1179,99 @@ end; // cvCalcArrHist(image, hist, accumulate, mask); // end; -procedure cvGetMinMaxHistValue; external imgproc_lib; +procedure cvGetMinMaxHistValue(const hist: pCvHistogram; min_value: pSingle; max_value: pSingle; min_idx: PInteger = nil; max_idx: PInteger = nil); cdecl; + external imgproc_lib; // procedure cvCalcArrHist; external imgproc_lib; -procedure cvCalcArrHist(var arr: PCvArr; hist: pCvHistogram; accumulate: Integer = 0; const mask: PCvArr = nil); cdecl; - external imgproc_lib; overload; -procedure cvCalcArrHist(var arr: pIplImage; hist: pCvHistogram; accumulate: Integer = 0; const mask: pIplImage = nil); cdecl; - external imgproc_lib; overload; -procedure cvCalcArrHist(var arr: pCvMat; hist: pCvHistogram; accumulate: Integer = 0; const mask: pCvMat = nil); cdecl; - external imgproc_lib; overload; -procedure cvCalcArrBackProject; external imgproc_lib; -// procedure cvCalcBackProject; external imgproc_lib name 'cvCalcArrBackProject'; -procedure cvCalcBackProject(var image: pIplImage; dst: PCvArr; const hist: pCvHistogram); cdecl; - external imgproc_lib name 'cvCalcArrBackProject'; overload; -procedure cvCalcBackProject(var image: PCvArr; dst: PCvArr; const hist: pCvHistogram); cdecl; - external imgproc_lib name 'cvCalcArrBackProject'; overload; -procedure cvGoodFeaturesToTrack; external imgproc_lib; -function cvMinAreaRect2; external imgproc_lib; -function cvMinEnclosingCircle; external imgproc_lib; -procedure cvBoxPoints; external imgproc_lib; -procedure cvLogPolar; external imgproc_lib; -procedure cvLinearPolar; external imgproc_lib; -procedure cvReleaseHist; external imgproc_lib; -procedure cvClearHist; external imgproc_lib; -procedure cvMoments; external imgproc_lib; -function cvGetSpatialMoment; external imgproc_lib; -procedure cvMatchTemplate; external imgproc_lib; -function cvGetCentralMoment; external imgproc_lib; -procedure cvUndistort2; external imgproc_lib; -function cvGetAffineTransform; external imgproc_lib; -procedure cvUndistortPoints; external imgproc_lib; +procedure cvCalcArrHist(var arr: PCvArr; hist: pCvHistogram; accumulate: Integer = 0; const mask: PCvArr = nil); cdecl; external imgproc_lib; overload; +procedure cvCalcArrHist(var arr: pIplImage; hist: pCvHistogram; accumulate: Integer = 0; const mask: pIplImage = nil); cdecl; external imgproc_lib; overload; +procedure cvCalcArrHist(var arr: pCvMat; hist: pCvHistogram; accumulate: Integer = 0; const mask: pCvMat = nil); cdecl; external imgproc_lib; overload; +procedure cvCalcArrBackProject(var image: PCvArr; dst: PCvArr; const hist: pCvHistogram); cdecl; external imgproc_lib; +//procedure cvCalcBackProject; external imgproc_lib name 'cvCalcArrBackProject'; +procedure cvCalcBackProject(var image: pIplImage; dst: PCvArr; const hist: pCvHistogram); cdecl; external imgproc_lib name 'cvCalcArrBackProject'; overload; +procedure cvCalcBackProject(var image: PCvArr; dst: PCvArr; const hist: pCvHistogram); cdecl; external imgproc_lib name 'cvCalcArrBackProject'; overload; +procedure cvGoodFeaturesToTrack(const image: PCvArr; eig_image: PCvArr; temp_image: PCvArr; corners: pCvPoint2D32f; corner_count: PInteger; + quality_level: Double; min_distance: Double; const mask: PCvArr = nil; block_size: Integer = 3; use_harris: Integer = 0; k: Double = 0.04); cdecl; + external imgproc_lib; +function cvMinAreaRect2(points: PCvArr; storage: pCvMemStorage = nil): TCvBox2D; cdecl; external imgproc_lib; +function cvMinEnclosingCircle(points: PCvArr; center: pCvPoint2D32f; radius: pSingle): Integer; cdecl; external imgproc_lib; +procedure cvBoxPoints(box: TCvBox2D; pt: TBoxPoints); cdecl; external imgproc_lib; +procedure cvLogPolar(const src: PCvArr; dst: PCvArr; center: TCvPoint2D32f; M: Double; flags: Integer = CV_INTER_LINEAR + CV_WARP_FILL_OUTLIERS); cdecl; + external imgproc_lib; +procedure cvLinearPolar(const src: PCvArr; dst: PCvArr; center: TCvPoint2D32f; maxRadius: Double; flags: Integer = CV_INTER_LINEAR + CV_WARP_FILL_OUTLIERS); + cdecl; external imgproc_lib; +procedure cvReleaseHist(Var hist: pCvHistogram); cdecl; external imgproc_lib; +procedure cvClearHist(hist: pCvHistogram); cdecl; external imgproc_lib; +procedure cvMoments(const arr: PCvArr; moments: pCvMoments; binary: Integer = 0); cdecl; external imgproc_lib; +function cvGetSpatialMoment(moments: pCvMoments; x_order, y_order: Integer): Double; cdecl; external imgproc_lib; +procedure cvMatchTemplate(const image: PCvArr; const templ: PCvArr; result: PCvArr; method: Integer); cdecl; external imgproc_lib; +function cvGetCentralMoment(moments: pCvMoments; x_order, y_order: Integer): Double; cdecl; external imgproc_lib; +procedure cvUndistort2(const src: PCvArr; dst: PCvArr; const camera_matrix: PCvArr; const distortion_coeffs: PCvArr; const new_camera_matrix: PCvArr = nil); + cdecl; external imgproc_lib; +function cvGetAffineTransform(const src: pCvPoint2D32f; const dst: pCvPoint2D32f; map_matrix: pCvMat): pCvMat; cdecl; external imgproc_lib; +procedure cvUndistortPoints(const src: pCvMat; dst: pCvMat; const camera_matrix: pCvMat; const dist_coeffs: pCvMat; const R: pCvMat = nil; + const P: pCvMat = nil); cdecl; external imgproc_lib; -function cvStartFindContours; external imgproc_lib; -function cvFindNextContour; external imgproc_lib; -procedure cvSubstituteContour; external imgproc_lib; -function cvEndFindContours; external imgproc_lib; +function cvStartFindContours(image: PCvArr; storage: pCvMemStorage; header_size: Integer { =sizeof(TCvContour)) }; mode: Integer { = CV_RETR_LIST }; + method: Integer { =CV_CHAIN_APPROX_SIMPLE }; offset: TCvPoint { =cvPoint(0,0) } ): pCvContourScanner; cdecl; external imgproc_lib; +function cvFindNextContour(scanner: pCvContourScanner): pCvSeq; cdecl; external imgproc_lib; +procedure cvSubstituteContour(scanner: pCvContourScanner; new_contour: pCvSeq); cdecl; external imgproc_lib; +function cvEndFindContours(Var scanner: pCvContourScanner): pCvSeq; cdecl; external imgproc_lib; -function cvCompareHist; external imgproc_lib; +function cvCompareHist(hist1: pCvHistogram; hist2: pCvHistogram; method: Integer): Double; cdecl; external imgproc_lib; -procedure cvAcc; external imgproc_lib; -procedure cvSquareAcc; external imgproc_lib; -procedure cvMultiplyAcc; external imgproc_lib; -procedure cvRunningAvg; external imgproc_lib; +procedure cvAcc(const image: PCvArr; sum: PCvArr; const mask: PCvArr = nil); cdecl; external imgproc_lib; +procedure cvSquareAcc(const image: PCvArr; sqsum: PCvArr; const mask: PCvArr = nil); cdecl; external imgproc_lib; +procedure cvMultiplyAcc(const image1: PCvArr; const image2: PCvArr; acc: PCvArr; const mask: PCvArr = nil); cdecl; external imgproc_lib; +procedure cvRunningAvg(const image: PCvArr; acc: PCvArr; alpha: Double; const mask: PCvArr = nil); cdecl; external imgproc_lib; -procedure cvFilter2D(const src: PCvArr; dst: PCvArr; const kernel: pCvMat; anchor: TCvPoint); external imgproc_lib; +procedure cvFilter2D(const src: PCvArr; dst: PCvArr; const kernel: pCvMat; anchor: TCvPoint); cdecl; external imgproc_lib; procedure cvFilter2D(const src: PCvArr; dst: PCvArr; const kernel: pCvMat); begin cvFilter2D(src, dst, kernel, CvPoint(-1, -1)); end; -function cvCreatePyramid; external imgproc_lib; -procedure cvReleasePyramid; external imgproc_lib; -procedure cvPyrMeanShiftFiltering; external imgproc_lib; -procedure cvWatershed; external imgproc_lib; -procedure cvConvertMaps; external imgproc_lib; -procedure cvInitUndistortRectifyMap; external imgproc_lib; -function cvGetNormalizedCentralMoment; external imgproc_lib; -procedure cvGetHuMoments; external imgproc_lib; -function cvSampleLine; external imgproc_lib; -procedure cvGetRectSubPix; external imgproc_lib; -procedure cvGetQuadrangleSubPix; external imgproc_lib; -function cvCalcEMD2; external imgproc_lib; -function cvApproxChains; external imgproc_lib; -procedure cvStartReadChainPoints; external imgproc_lib; -function cvReadChainPoint; external imgproc_lib; -function cvFitEllipse2; external imgproc_lib; -function cvMaxRect; external imgproc_lib; -function cvPointSeqFromMat; external imgproc_lib; -function cvPointPolygonTest; external imgproc_lib; -procedure cvSetHistBinRanges; external imgproc_lib; -function cvMakeHistHeaderForArray; external imgproc_lib; -procedure cvNormalizeHist; external imgproc_lib; -procedure cvThreshHist; external imgproc_lib; -procedure cvCopyHist; external imgproc_lib; -procedure cvCalcBayesianProb; external imgproc_lib; -procedure cvCalcArrBackProjectPatch; external imgproc_lib; -procedure cvCalcProbDensity; external imgproc_lib; -procedure cvDistTransform; external imgproc_lib; -procedure cvPreCornerDetect; external imgproc_lib; -procedure cvCornerEigenValsAndVecs; external imgproc_lib; -procedure cvCornerMinEigenVal; external imgproc_lib; -procedure cvCornerHarris; external imgproc_lib; -procedure cvFitLine; external imgproc_lib; +function cvCreatePyramid(const img: PCvArr; extra_layers: Integer; rate: Double; const layer_sizes: pCvSize = nil; bufarr: PCvArr = nil; calc: Integer = 1; + filter: Integer = CV_GAUSSIAN_5x5): ppCvMat; cdecl; external imgproc_lib; +procedure cvReleasePyramid(var pyramid: ppCvMat; extra_layers: Integer); cdecl; external imgproc_lib; +procedure cvPyrMeanShiftFiltering(const src: PCvArr; dst: PCvArr; sp: Double; sr: Double; max_level: Integer { = 1 }; + termcrit: TCvTermCriteria { = CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 5, 1)) } ); cdecl; external imgproc_lib; +procedure cvWatershed(const image: PCvArr; markers: PCvArr); cdecl; external imgproc_lib; +procedure cvConvertMaps(const mapx: PCvArr; const mapy: PCvArr; mapxy: PCvArr; mapalpha: PCvArr); cdecl; external imgproc_lib; +procedure cvInitUndistortRectifyMap(const camera_matrix: pCvMat; const dist_coeffs: pCvMat; const R: pCvMat; const new_camera_matrix: pCvMat; mapx: PCvArr; + mapy: PCvArr); cdecl; external imgproc_lib; +function cvGetNormalizedCentralMoment(moments: pCvMoments; x_order: Integer; y_order: Integer): Double; cdecl; external imgproc_lib; +procedure cvGetHuMoments(moments: pCvMoments; hu_moments: pCvHuMoments); cdecl; external imgproc_lib; +function cvSampleLine(const image: PCvArr; pt1: TCvPoint; pt2: TCvPoint; buffer: Pointer; connectivity: Integer = 8): Integer; cdecl; external imgproc_lib; +procedure cvGetRectSubPix(const src: PCvArr; dst: PCvArr; center: TCvPoint2D32f); cdecl; external imgproc_lib; +procedure cvGetQuadrangleSubPix(const src: PCvArr; dst: PCvArr; const map_matrix: pCvMat); cdecl; external imgproc_lib; +function cvCalcEMD2(const signature1: PCvArr; const signature2: PCvArr; distance_type: Integer; distance_func: TCvDistanceFunction = nil; + const cost_matrix: PCvArr = nil; flow: PCvArr = nil; lower_bound: pfloat = nil; userdata: Pointer = nil): float; cdecl; external imgproc_lib; +function cvApproxChains(src_seq: pCvSeq; storage: pCvMemStorage; method: Integer = CV_CHAIN_APPROX_SIMPLE; parameter: Double = 0; + minimal_perimeter: Integer = 0; recursive: Integer = 0): pCvSeq; cdecl; external imgproc_lib; +procedure cvStartReadChainPoints(chain: pCvChain; reader: pCvChainPtReader); cdecl; external imgproc_lib; +function cvReadChainPoint(reader: pCvChainPtReader): TCvPoint; cdecl; external imgproc_lib; +function cvFitEllipse2(const points: PCvArr): TCvBox2D; cdecl; external imgproc_lib; +function cvMaxRect(const rect1: pCvRect; const rect2: pCvRect): TCvRect; cdecl; external imgproc_lib; +function cvPointSeqFromMat(seq_kind: Integer; const mat: PCvArr; contour_header: pCvContour; block: pCvSeqBlock): pCvSeq; cdecl; external imgproc_lib; +function cvPointPolygonTest(const contour: PCvArr; pt: TCvPoint2D32f; measure_dist: Integer): Double; cdecl; external imgproc_lib; +procedure cvSetHistBinRanges(hist: pCvHistogram; ranges: pSingle; uniform: Integer = 1); cdecl; external imgproc_lib; +function cvMakeHistHeaderForArray(dims: Integer; sizes: PInteger; hist: pCvHistogram; data: pfloat; ranges: ppfloat = nil; uniform: Integer = 1): pCvHistogram; + cdecl; external imgproc_lib; +procedure cvNormalizeHist(hist: pCvHistogram; factor: Double); cdecl; external imgproc_lib; +procedure cvThreshHist(hist: pCvHistogram; threshold: Double); cdecl; external imgproc_lib; +procedure cvCopyHist(const src: pCvHistogram; Var dst: pCvHistogram); cdecl; external imgproc_lib; +procedure cvCalcBayesianProb(Var src: pCvHistogram; number: Integer; Var dst: pCvHistogram); cdecl; external imgproc_lib; +procedure cvCalcArrBackProjectPatch(var image: PCvArr; dst: PCvArr; range: TCvSize; hist: pCvHistogram; method: Integer; factor: Double); cdecl; + external imgproc_lib; +procedure cvCalcProbDensity(const hist1: pCvHistogram; const hist2: pCvHistogram; dst_hist: pCvHistogram; scale: Double = 255); cdecl; external imgproc_lib; +procedure cvDistTransform(const src: PCvArr; dst: PCvArr; distance_type: Integer = CV_DIST_L2; mask_size: Integer = 3; const mask: pfloat = nil; + labels: PCvArr = nil; labelType: Integer = CV_DIST_LABEL_CCOMP); cdecl; external imgproc_lib; +procedure cvPreCornerDetect(const image: PCvArr; corners: PCvArr; aperture_size: Integer = 3); cdecl; external imgproc_lib; +procedure cvCornerEigenValsAndVecs(const image: PCvArr; eigenvv: PCvArr; block_size: Integer; aperture_size: Integer = 3); cdecl; external imgproc_lib; +procedure cvCornerMinEigenVal(const image: PCvArr; eigenval: PCvArr; block_size: Integer; aperture_size: Integer = 3); cdecl; external imgproc_lib; +procedure cvCornerHarris(const image: PCvArr; harris_response: PCvArr; block_size: Integer; aperture_size: Integer = 3; k: Double = 0.04); cdecl; + external imgproc_lib; +procedure cvFitLine(const points: PCvArr; dist_type: Integer; param: Double; reps: Double; aeps: Double; Var line: Single); cdecl; external imgproc_lib; end. diff --git a/source/ocv.legacy.pas b/source/ocv.legacy.pas index 16f12c6..4918d53 100644 --- a/source/ocv.legacy.pas +++ b/source/ocv.legacy.pas @@ -46,9 +46,10 @@ ************************************************************************************************* *) -{$I OpenCV.inc} unit ocv.legacy; +{$I OpenCV.inc} + interface uses @@ -65,8 +66,7 @@ uses *) {$EXTERNALSYM cvSegmentImage} -function cvSegmentImage(const srcarr: pCvArr; dstarr: pCvArr; canny_threshold: double; ffill_threshold: double; storage: pCvMemStorage) - : pCvSeq; cdecl; +function cvSegmentImage(const srcarr: pCvArr; dstarr: pCvArr; canny_threshold: double; ffill_threshold: double; storage: pCvMemStorage): pCvSeq; cdecl; { **************************************************************************************** * Eigen objects * @@ -76,14 +76,14 @@ Type (* typedef int (CV_CDECL * CvCallback)(int index, void* buffer, void* user_data); *) TCvCallback = function(index: Integer; buffer: pointer; user_data: pointer): Integer; cdecl; - (* - typedef union - { - CvCallback callback; - void* data; - } - CvInput; - *) + // + // typedef union + // { + // CvCallback callback; + // void* data; + // } + // CvInput; + TCvInput = record case boolean of True: @@ -93,10 +93,10 @@ Type end; const - CV_EIGOBJ_NO_CALLBACK = 0; - CV_EIGOBJ_INPUT_CALLBACK = 1; + CV_EIGOBJ_NO_CALLBACK = 0; + CV_EIGOBJ_INPUT_CALLBACK = 1; CV_EIGOBJ_OUTPUT_CALLBACK = 2; - CV_EIGOBJ_BOTH_CALLBACK = 3; + CV_EIGOBJ_BOTH_CALLBACK = 3; (* Calculates covariation matrix of a set of arrays @@ -105,8 +105,8 @@ const IplImage* avg, float* covarMatrix ); *) {$EXTERNALSYM cvCalcCovarMatrixEx} -procedure cvCalcCovarMatrixEx(nObjects: Integer; input: pointer; ioFlags: Integer; ioBufSize: Integer; buffer: pByte; userData: pointer; - avg: pIplImage; var covarMatrix: Single); cdecl; +procedure cvCalcCovarMatrixEx(nObjects: Integer; input: pointer; ioFlags: Integer; ioBufSize: Integer; buffer: pByte; userData: pointer; avg: pIplImage; + var covarMatrix: Single); cdecl; (* Calculates eigen values and vectors of covariation matrix of a set of arrays @@ -133,8 +133,7 @@ function cvCalcDecompCoeff(obj: pIplImage; eigObj: pIplImage; avg: pIplImage): d float* coeffs ); *) {$EXTERNALSYM cvEigenDecomposite} -procedure cvEigenDecomposite(obj: pIplImage; nEigObjs: Integer; eigInput: pointer; ioFlags: Integer; userData: pointer; avg: pIplImage; - coeffs: pFloat); cdecl; +procedure cvEigenDecomposite(obj: pIplImage; nEigObjs: Integer; eigInput: pointer; ioFlags: Integer; userData: pointer; avg: pIplImage; coeffs: pFloat); cdecl; (* Projects original objects used to calculate eigen space basis to that space @@ -143,8 +142,7 @@ procedure cvEigenDecomposite(obj: pIplImage; nEigObjs: Integer; eigInput: pointe IplImage* proj ); *) {$EXTERNALSYM cvEigenProjection} -procedure cvEigenProjection(eigInput: pointer; nEigObjs: Integer; ioFlags: Integer; userData: pointer; coeffs: PSingle; avg: pIplImage; - proj: pIplImage); cdecl; +procedure cvEigenProjection(eigInput: pointer; nEigObjs: Integer; ioFlags: Integer; userData: pointer; coeffs: PSingle; avg: pIplImage; proj: pIplImage); cdecl; // { **************************************************************************************** * 1D/2D HMM * @@ -170,9 +168,9 @@ Type obs_x: Integer; obs_y: Integer; obs_size: Integer; - obs: PSingle; // consequtive observations + obs: PSingle; // consequtive observations state: PInteger; (* arr of pairs superstate/state to which observation belong *) - mix: PInteger; (* number of mixture to which observation belong *) + mix: PInteger; (* number of mixture to which observation belong *) end; // typedef CvImgObsInfo Cv1DObsInfo; @@ -192,11 +190,11 @@ Type pCvEHMMState = ^TCvEHMMState; TCvEHMMState = record - num_mix: Integer; (* number of mixtures in this state *) - mu: PSingle; (* mean vectors corresponding to each mixture *) - inv_var: PSingle; (* square root of inversed variances corresp. to each mixture *) + num_mix: Integer; (* number of mixtures in this state *) + mu: PSingle; (* mean vectors corresponding to each mixture *) + inv_var: PSingle; (* square root of inversed variances corresp. to each mixture *) log_var_val: PSingle; (* sum of 0.5 (LN2PI + ln(variance[i]) ) for i=1,n *) - weight: PSingle; (* array of mixture weights. Summ of all weights in state is 1. *) + weight: PSingle; (* array of mixture weights. Summ of all weights in state is 1. *) end; // typedef struct CvEHMM @@ -221,9 +219,9 @@ Type pObsProb = ^TObsProb; TCvEHMM = record - level: Integer; (* 0 - lowest(i.e its states are real states), ..... *) + level: Integer; (* 0 - lowest(i.e its states are real states), ..... *) num_states: Integer; (* number of HMM states *) - transP: PSingle; (* transition probab. matrices for states *) + transP: PSingle; (* transition probab. matrices for states *) obsProb: pObsProb; (* if level == 0 - array of brob matrices corresponding to hmm if level == 1 - martix of matrices *) case u: byte of @@ -285,13 +283,12 @@ function cvCreate2DHMM(Var stateNumber: Integer; Var numMix: Integer; obsSize: I {$EXTERNALSYM cvRelease2DHMM} procedure cvRelease2DHMM(var hmm: pCvEHMM); cdecl; -(* - #define CV_COUNT_OBS(roi, win, delta, numObs ) \ - { \ - (numObs)->width =((roi)->width -(win)->width +(delta)->width)/(delta)->width; \ - (numObs)->height =((roi)->height -(win)->height +(delta)->height)/(delta)->height;\ - } -*) + +// #define CV_COUNT_OBS(roi, win, delta, numObs ) \ +// { \ +// (numObs)->width =((roi)->width -(win)->width +(delta)->width)/(delta)->width; \ +// (numObs)->height =((roi)->height -(win)->height +(delta)->height)/(delta)->height;\ +// } (* Creates storage for observation vectors CVAPI(CvImgObsInfo* ) cvCreateObsInfo( CvSize numObs, int obsSize ); @@ -467,8 +464,8 @@ const double parameter4 CV_DEFAULT(0)); *) -function cvFindDominantPoints(contour: pCvSeq; storage: pCvMemStorage; method: Integer = CV_DOMINANT_IPAN; parameter1: double = 0; - parameter2: double = 0; parameter3: double = 0; parameter4: double = 0): pCvSeq; cdecl; +function cvFindDominantPoints(contour: pCvSeq; storage: pCvMemStorage; method: Integer = CV_DOMINANT_IPAN; parameter1: double = 0; parameter2: double = 0; + parameter3: double = 0; parameter4: double = 0): pCvSeq; cdecl; (* *************************************************************************************** *) // @@ -653,25 +650,24 @@ function cvFindDominantPoints(contour: pCvSeq; storage: pCvMemStorage; method: I (* *************************************************************************************** *) (* *********** Epiline functions ****************** *) Type - (* - typedef struct CvStereoLineCoeff - { - double Xcoef; - double XcoefA; - double XcoefB; - double XcoefAB; - double Ycoef; - double YcoefA; - double YcoefB; - double YcoefAB; - - double Zcoef; - double ZcoefA; - double ZcoefB; - double ZcoefAB; - }CvStereoLineCoeff; - *) + // typedef struct CvStereoLineCoeff + // { + // double Xcoef; + // double XcoefA; + // double XcoefB; + // double XcoefAB; + // + // double Ycoef; + // double YcoefA; + // double YcoefB; + // double YcoefAB; + // + // double Zcoef; + // double ZcoefA; + // double ZcoefB; + // double ZcoefAB; + // }CvStereoLineCoeff; pCvStereoLineCoeff = ^TCvStereoLineCoeff; @@ -692,18 +688,18 @@ Type ZcoefAB: double; end; - (* - typedef struct CvCamera - { - float imgSize[2]; ( * size of the camera view, used during calibration * ) - float matrix[9]; ( * intinsic camera parameters: [ fx 0 cx; 0 fy cy; 0 0 1 ] * ) - float distortion[4]; ( * distortion coefficients - two coefficients for radial distortion - and another two for tangential: [ k1 k2 p1 p2 ] * ) - float rotMatr[9]; - float transVect[3]; ( * rotation matrix and transition vector relatively - to some reference point in the space. * ) - } CvCamera; - *) + + // typedef struct CvCamera + // { + // float imgSize[2]; ( * size of the camera view, used during calibration * ) + // float matrix[9]; ( * intinsic camera parameters: [ fx 0 cx; 0 fy cy; 0 0 1 ] * ) + // float distortion[4]; ( * distortion coefficients - two coefficients for radial distortion + // and another two for tangential: [ k1 k2 p1 p2 ] * ) + // float rotMatr[9]; + // float transVect[3]; ( * rotation matrix and transition vector relatively + // to some reference point in the space. * ) + // } CvCamera; + pCvCamera = ^TCvCamera; TCvCamera = record @@ -718,31 +714,30 @@ Type to some reference point in the space. *) end; - (* - typedef struct CvStereoCamera - { - CvCamera* camera[2]; ( * two individual camera parameters * ) - float fundMatr[9]; ( * fundamental matrix * ) - ( * New part for stereo * ) - CvPoint3D32f epipole[2]; - CvPoint2D32f quad[2][4]; ( * coordinates of destination quadrangle after - epipolar geometry rectification * ) - double coeffs[2][3][3];( * coefficients for transformation * ) - CvPoint2D32f border[2][4]; - CvSize warpSize; - CvStereoLineCoeff* lineCoeffs; - int needSwapCameras;( * flag set to 1 if need to swap cameras for good reconstruction * ) - float rotMatrix[9]; - float transVector[3]; - } CvStereoCamera; - *) + // typedef struct CvStereoCamera + // { + // CvCamera* camera[2]; ( * two individual camera parameters * ) + // float fundMatr[9]; ( * fundamental matrix * ) + // + // ( * New part for stereo * ) + // CvPoint3D32f epipole[2]; + // CvPoint2D32f quad[2][4]; ( * coordinates of destination quadrangle after + // epipolar geometry rectification * ) + // double coeffs[2][3][3];( * coefficients for transformation * ) + // CvPoint2D32f border[2][4]; + // CvSize warpSize; + // CvStereoLineCoeff* lineCoeffs; + // int needSwapCameras;( * flag set to 1 if need to swap cameras for good reconstruction * ) + // float rotMatrix[9]; + // float transVector[3]; + // } CvStereoCamera; pCvStereoCamera = ^TCvStereoCamera; TCvStereoCamera = record camera: array [0 .. 1] of pCvCamera; (* two individual camera parameters *) - fundMatr: array [0 .. 8] of Single; (* fundamental matrix *) + fundMatr: array [0 .. 8] of Single; (* fundamental matrix *) (* New part for stereo *) epipole: array [0 .. 1] of TCvPoint3D32f; quad: array [0 .. 1, 0 .. 3] of TCvPoint2D32f; (* coordinates of destination quadrangle after @@ -756,16 +751,15 @@ Type transVector: array [0 .. 2] of Single; end; - (* - // typedef struct CvContourOrientation - // { - // float egvals[2]; - // float egvects[4]; - // - // float max, min; // minimum and maximum projections - // int imax, imin; - // } CvContourOrientation; - *) + + // typedef struct CvContourOrientation + // { + // float egvals[2]; + // float egvects[4]; + // + // float max, min; // minimum and maximum projections + // int imax, imin; + // } CvContourOrientation; pCvContourOrientation = ^TCvContourOrientation; @@ -1049,33 +1043,33 @@ const int coeff_usage, CvSize win, CvTermCriteria criteria, int calc_gradient CV_DEFAULT(1)); } -procedure cvSnakeImage(const image: pIplImage; points: pCvPointArray; length: Integer; alpha: PSingle; beta: PSingle; gamma: PSingle; - coeff_usage: Integer; win: TCvSize; criteria: TCvTermCriteria; calc_gradient: Integer = 1); cdecl; +procedure cvSnakeImage(const image: pIplImage; points: pCvPointArray; length: Integer; alpha: PSingle; beta: PSingle; gamma: PSingle; coeff_usage: Integer; + win: TCvSize; criteria: TCvTermCriteria; calc_gradient: Integer = 1); cdecl; (* ***************************************************************************************\ // * Texture Descriptors * // \*************************************************************************************** *) const - CV_GLCM_OPTIMIZATION_NONE = -2; - CV_GLCM_OPTIMIZATION_LUT = -1; + CV_GLCM_OPTIMIZATION_NONE = -2; + CV_GLCM_OPTIMIZATION_LUT = -1; CV_GLCM_OPTIMIZATION_HISTOGRAM = 0; CV_GLCMDESC_OPTIMIZATION_ALLOWDOUBLENEST = 10; CV_GLCMDESC_OPTIMIZATION_ALLOWTRIPLENEST = 11; - CV_GLCMDESC_OPTIMIZATION_HISTOGRAM = 4; + CV_GLCMDESC_OPTIMIZATION_HISTOGRAM = 4; - CV_GLCMDESC_ENTROPY = 0; - CV_GLCMDESC_ENERGY = 1; - CV_GLCMDESC_HOMOGENITY = 2; - CV_GLCMDESC_CONTRAST = 3; - CV_GLCMDESC_CLUSTERTENDENCY = 4; - CV_GLCMDESC_CLUSTERSHADE = 5; - CV_GLCMDESC_CORRELATION = 6; - CV_GLCMDESC_CORRELATIONINFO1 = 7; - CV_GLCMDESC_CORRELATIONINFO2 = 8; + CV_GLCMDESC_ENTROPY = 0; + CV_GLCMDESC_ENERGY = 1; + CV_GLCMDESC_HOMOGENITY = 2; + CV_GLCMDESC_CONTRAST = 3; + CV_GLCMDESC_CLUSTERTENDENCY = 4; + CV_GLCMDESC_CLUSTERSHADE = 5; + CV_GLCMDESC_CORRELATION = 6; + CV_GLCMDESC_CORRELATIONINFO1 = 7; + CV_GLCMDESC_CORRELATIONINFO2 = 8; CV_GLCMDESC_MAXIMUMPROBABILITY = 9; - CV_GLCM_ALL = 0; + CV_GLCM_ALL = 0; CV_GLCM_GLCM = 1; CV_GLCM_DESC = 2; @@ -3172,7 +3166,6 @@ Type // int level, double threshold1, // double threshold2 ); procedure cvPyrSegmentation(src: pIplImage; dst: pIplImage; storage: pCvMemStorage; - var comp: pCvSeq; level: Integer; threshold1: double; threshold2: double); cdecl; (* ***************************************************************************************\ @@ -3228,24 +3221,24 @@ Type const { CvSubdiv2DPointLocation enum } - CV_PTLOC_ERROR = -2; + CV_PTLOC_ERROR = -2; CV_PTLOC_OUTSIDE_RECT = -1; - CV_PTLOC_INSIDE = 0; - CV_PTLOC_VERTEX = 1; - CV_PTLOC_ON_EDGE = 2; + CV_PTLOC_INSIDE = 0; + CV_PTLOC_VERTEX = 1; + CV_PTLOC_ON_EDGE = 2; Type TCvNextEdgeType = Integer; const { CvNextEdgeType enum } - CV_NEXT_AROUND_ORG = $00; - CV_NEXT_AROUND_DST = $22; - CV_PREV_AROUND_ORG = $11; - CV_PREV_AROUND_DST = $33; - CV_NEXT_AROUND_LEFT = $13; + CV_NEXT_AROUND_ORG = $00; + CV_NEXT_AROUND_DST = $22; + CV_PREV_AROUND_ORG = $11; + CV_PREV_AROUND_DST = $33; + CV_NEXT_AROUND_LEFT = $13; CV_NEXT_AROUND_RIGHT = $31; - CV_PREV_AROUND_LEFT = $20; + CV_PREV_AROUND_LEFT = $20; CV_PREV_AROUND_RIGHT = $02; (* get the next edge with the same origin point (counterwise) *) @@ -3259,8 +3252,7 @@ procedure cvInitSubdivDelaunay2D(subdiv: pCvSubdiv2D; rect: TCvRect); cdecl; // CVAPI(CvSubdiv2D*) cvCreateSubdiv2D( int subdiv_type, int header_size, // int vtx_size, int quadedge_size, // CvMemStorage* storage ); -function cvCreateSubdiv2D(subdiv_type: Integer; header_size: Integer; vtx_size: Integer; quadedge_size: Integer; storage: pCvMemStorage) - : pCvSubdiv2D; cdecl; +function cvCreateSubdiv2D(subdiv_type: Integer; header_size: Integer; vtx_size: Integer; quadedge_size: Integer; storage: pCvMemStorage): pCvSubdiv2D; cdecl; (* ************************ high-level subdivision functions ************************** *) // @@ -3286,8 +3278,7 @@ function cvSubdivDelaunay2DInsert(subdiv: pCvSubdiv2D; pt: TCvPoint2D32f): pCvSu // CvSubdiv2DEdge* edge, // CvSubdiv2DPoint** vertex CV_DEFAULT(NULL) ); -function cvSubdiv2DLocate(subdiv: pCvSubdiv2D; pt: TCvPoint2D32f; edge: pCvSubdiv2DEdge; vertex: pCvSubdiv2DPoint = nil) - : TCvSubdiv2DPointLocation; cdecl; +function cvSubdiv2DLocate(subdiv: pCvSubdiv2D; pt: TCvPoint2D32f; edge: pCvSubdiv2DEdge; vertex: pCvSubdiv2DPoint = nil): TCvSubdiv2DPointLocation; cdecl; (* Calculates Voronoi tesselation (i.e. coordinates of Voronoi points) *) // CVAPI(void) cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv ); @@ -3451,9 +3442,7 @@ Type function cvCreateStereoGCState(numberOfDisparities: Integer; maxIters: Integer): pCvStereoGCState; cdecl; // CVAPI(void) cvReleaseStereoGCState( CvStereoGCState** state ); -procedure cvReleaseStereoGCState( - - Var state: pCvStereoGCState); cdecl; +procedure cvReleaseStereoGCState(Var state: pCvStereoGCState); cdecl; { CVAPI(void) cvFindStereoCorrespondenceGC( @@ -3465,9 +3454,8 @@ procedure cvReleaseStereoGCState( int useDisparityGuess CV_DEFAULT(0) ); } -procedure cvFindStereoCorrespondenceGC(const left: pIplImage; - - const right: pIplImage; disparityLeft: pCvMat; disparityRight: pCvMat; state: pCvStereoGCState; useDisparityGuess: Integer = 0); cdecl; +procedure cvFindStereoCorrespondenceGC(const left: pIplImage; const right: pIplImage; disparityLeft: pCvMat; disparityRight: pCvMat; state: pCvStereoGCState; + useDisparityGuess: Integer = 0); cdecl; (* Calculates optical flow for 2 images using classical Lucas & Kanade algorithm *) // CVAPI(void) cvCalcOpticalFlowLK( const CvArr* prev, const CvArr* curr, @@ -3517,10 +3505,10 @@ procedure cvFindStereoCorrespondenceGC(const left: pIplImage; // * C Stauffer and W Grimson August 2000 // * IEEE Transactions on Pattern Analysis and Machine Intelligence 22(8):747-757 // *) -// + const - CV_BG_MODEL_FGD = 0; - CV_BG_MODEL_MOG = 1; // * "Mixture of Gaussians". *) + CV_BG_MODEL_FGD = 0; + CV_BG_MODEL_MOG = 1; // * "Mixture of Gaussians". *) CV_BG_MODEL_FGD_SIMPLE = 2; Type @@ -3541,10 +3529,10 @@ Type update: TCvUpdateBGStatModel; background: pIplImage; // *8UC3 reference background image - foreground: pIplImage; // *8UC1 foreground image - layers: pIplImage; // *8UC3 reference background image, can be null - layer_count: Integer; // * can be zero - storage: pCvMemStorage; // *storage for foreground_regions + foreground: pIplImage; // *8UC1 foreground image + layers: pIplImage; // *8UC3 reference background image, can be null + layer_count: Integer; // * can be zero + storage: pCvMemStorage; // *storage for foreground_regions foreground_regions: pCvSeq; // *foreground object contours end; @@ -3586,11 +3574,11 @@ function cvUpdateBGStatModel(current_frame: pIplImage; bg_model: pCvBGStatModel; const // Default parameters of foreground detection algorithm: - CV_BGFG_FGD_LC = 128; + CV_BGFG_FGD_LC = 128; CV_BGFG_FGD_N1C = 15; CV_BGFG_FGD_N2C = 25; - CV_BGFG_FGD_LCC = 64; + CV_BGFG_FGD_LCC = 64; CV_BGFG_FGD_N1CC = 25; CV_BGFG_FGD_N2CC = 40; // Background reference image update parameter: *) @@ -3602,10 +3590,10 @@ const CV_BGFG_FGD_ALPHA_2 = 0.005; // * start value for alpha parameter (to fast initiate statistic model) *) - CV_BGFG_FGD_ALPHA_3 = 0.1; - CV_BGFG_FGD_DELTA = 2; - CV_BGFG_FGD_T = 0.9; - CV_BGFG_FGD_MINAREA = 15; + CV_BGFG_FGD_ALPHA_3 = 0.1; + CV_BGFG_FGD_DELTA = 2; + CV_BGFG_FGD_T = 0.9; + CV_BGFG_FGD_MINAREA = 15; CV_BGFG_FGD_BG_UPDATE_TRESH = 0.5; (* See the above-referenced Li/Huang/Gu/Tian paper @@ -3693,8 +3681,7 @@ Type (* Creates FGD model *) // CVAPI(CvBGStatModel*) cvCreateFGDStatModel( IplImage* first_frame, CvFGDStatModelParams* parameters CV_DEFAULT(NULL)); -function cvCreateFGDStatModel(first_frame: pIplImage; parameters: pCvFGDStatModelParams = nil): pCvBGStatModel; -cdecl +function cvCreateFGDStatModel(first_frame: pIplImage; parameters: pCvFGDStatModelParams = nil): pCvBGStatModel; cdecl; // Interface of Gaussian mixture algorithm // @@ -3711,11 +3698,11 @@ const CV_BGFG_MOG_BACKGROUND_THRESHOLD = 0.7; // * threshold sum of weights for background test *) CV_BGFG_MOG_STD_THRESHOLD = 2.5; // * lambda=2.5 is 99% *) - CV_BGFG_MOG_WINDOW_SIZE = 200; // * Learning rate; alpha = 1/CV_GBG_WINDOW_SIZE *) - CV_BGFG_MOG_NGAUSSIANS = 5; // * = K = number of Gaussians in mixture *) - CV_BGFG_MOG_WEIGHT_INIT = 0.05; - CV_BGFG_MOG_SIGMA_INIT = 30; - CV_BGFG_MOG_MINAREA = 15; + CV_BGFG_MOG_WINDOW_SIZE = 200; // * Learning rate; alpha = 1/CV_GBG_WINDOW_SIZE *) + CV_BGFG_MOG_NGAUSSIANS = 5; // * = K = number of Gaussians in mixture *) + CV_BGFG_MOG_WEIGHT_INIT = 0.05; + CV_BGFG_MOG_SIGMA_INIT = 30; + CV_BGFG_MOG_MINAREA = 15; CV_BGFG_MOG_NCOLORS = 3; @@ -3751,11 +3738,11 @@ type _type: Integer; // type of BG model release: TCvReleaseBGStatModel; update: TCvUpdateBGStatModel; - background: pIplImage; // 8UC3 reference background image - foreground: pIplImage; // 8UC1 foreground image - layers: pIplImage; // 8UC3 reference background image, can be null - layer_count: Integer; // can be zero - storage: pCvMemStorage; // storage for foreground_regions + background: pIplImage; // 8UC3 reference background image + foreground: pIplImage; // 8UC1 foreground image + layers: pIplImage; // 8UC3 reference background image, can be null + layer_count: Integer; // can be zero + storage: pCvMemStorage; // storage for foreground_regions foreground_regions: pCvSeq; // foreground object contours params: TCvGaussBGStatModelParams; g_point: pCvGaussBGPoint; @@ -3798,33 +3785,24 @@ function cvCreateBGCodeBookModel: pCvBGCodeBookModel; cdecl; // CVAPI(void) cvReleaseBGCodeBookModel( CvBGCodeBookModel** model ); procedure cvReleaseBGCodeBookModel(model: pCvBGCodeBookModel); cdecl; // CVAPI(void) cvBGCodeBookUpdate( CvBGCodeBookModel* model, const CvArr* image, CvRect roi CV_DEFAULT(cvRect(0,0,0,0)),const CvArr* mask CV_DEFAULT(0) ); -procedure cvBGCodeBookUpdate(model: pCvBGCodeBookModel; - - const image: pIplImage; roi: TCvRect { =CV_DEFAULT(cvRect(0,0,0,0)) }; - +procedure cvBGCodeBookUpdate(model: pCvBGCodeBookModel; const image: pIplImage; roi: TCvRect { =CV_DEFAULT(cvRect(0,0,0,0)) }; const mask: pCvArr { =0 } ); cdecl; // CVAPI(int) cvBGCodeBookDiff( const CvBGCodeBookModel* model, const CvArr* image, CvArr* fgmask, CvRect roi CV_DEFAULT(cvRect(0,0,0,0)) ); -function cvBGCodeBookDiff( - - const model: pCvBGCodeBookModel; - - const image: pCvArr; fgmask: pCvArr; roi: TCvRect { = cvRect(0,0,0,0) } ): Integer; cdecl; +function cvBGCodeBookDiff(const model: pCvBGCodeBookModel; const image: pCvArr; fgmask: pCvArr; roi: TCvRect { = cvRect(0,0,0,0) } ): Integer; cdecl; // CVAPI(void) cvBGCodeBookClearStale( CvBGCodeBookModel* model, int staleThresh, CvRect roi CV_DEFAULT(cvRect(0,0,0,0)), const CvArr* mask CV_DEFAULT(0) ); -procedure cvBGCodeBookClearStale(model: pCvBGCodeBookModel; staleThresh: Integer; roi: TCvRect { =cvRect(0,0,0,0) }; - - const mask: pCvArr = nil); cdecl; +procedure cvBGCodeBookClearStale(model: pCvBGCodeBookModel; staleThresh: Integer; roi: TCvRect { =cvRect(0,0,0,0) }; const mask: pCvArr = nil); cdecl; // CVAPI(CvSeq*) cvSegmentFGMask( CvArr *fgmask, int poly1Hull0 CV_DEFAULT(1), float perimScale CV_DEFAULT(4.f), CvMemStorage* storage CV_DEFAULT(0), CvPoint offset CV_DEFAULT(cvPoint(0,0))); function cvSegmentFGMask(fgmask: pCvArr; poly1Hull0: Integer { =1 }; perimScale: Single { = 4 }; storage: pCvMemStorage { =nil }; offset: TCvPoint { =cvPoint(0,0) } ): pCvSeq; cdecl; const - CV_UNDEF_SC_PARAM = 12345; // default value of parameters + CV_UNDEF_SC_PARAM = 12345; // default value of parameters CV_IDP_BIRCHFIELD_PARAM1 = 25; CV_IDP_BIRCHFIELD_PARAM2 = 5; CV_IDP_BIRCHFIELD_PARAM3 = 12; CV_IDP_BIRCHFIELD_PARAM4 = 15; CV_IDP_BIRCHFIELD_PARAM5 = 25; - CV_DISPARITY_BIRCHFIELD = 0; + CV_DISPARITY_BIRCHFIELD = 0; (* F/////////////////////////////////////////////////////////////////////////// // @@ -3955,8 +3933,8 @@ function icvCompute3DPoint(alpha: double; betta: double; coeffs: pCvStereoLineCo double* convRotMatr, double* convTransVect); *) -function icvCreateConvertMatrVect(rotMatr1: pdouble; transVect1: pdouble; rotMatr2: pdouble; transVect2: pdouble; convRotMatr: pdouble; - convTransVect: pdouble): Integer; cdecl; +function icvCreateConvertMatrVect(rotMatr1: pdouble; transVect1: pdouble; rotMatr2: pdouble; transVect2: pdouble; convRotMatr: pdouble; convTransVect: pdouble) + : Integer; cdecl; (* CVAPI(int) icvConvertPointSystem(CvPoint3D64f M2, CvPoint3D64f* M1, @@ -4016,9 +3994,8 @@ procedure cvComputePerspectiveMap(const coeffs: TicvConvertWarpCoordinatesCoeff; CvStereoLineCoeff* coeffs, int* needSwapCameras); *) -function icvComCoeffForLine(point1: TCvPoint2D64f; point2: TCvPoint2D64f; point3: TCvPoint2D64f; point4: TCvPoint2D64f; camMatr1: pdouble; - rotMatr1: pdouble; transVect1: pdouble; camMatr2: pdouble; rotMatr2: pdouble; transVect2: pdouble; coeffs: pCvStereoLineCoeff; - needSwapCameras: PInteger): Integer; cdecl; +function icvComCoeffForLine(point1: TCvPoint2D64f; point2: TCvPoint2D64f; point3: TCvPoint2D64f; point4: TCvPoint2D64f; camMatr1: pdouble; rotMatr1: pdouble; + transVect1: pdouble; camMatr2: pdouble; rotMatr2: pdouble; transVect2: pdouble; coeffs: pCvStereoLineCoeff; needSwapCameras: PInteger): Integer; cdecl; (* CVAPI(int) icvGetDirectionForPoint( CvPoint2D64f point, double* camMatr, @@ -4096,8 +4073,7 @@ procedure icvGetCrossDirectDirect(direct1: pdouble; direct2: pdouble; cross: pCv double a,double b,double c, CvPoint2D64f *cross,int* result); *) -procedure icvGetCrossPieceDirect(p_start: TCvPoint2D64f; p_end: TCvPoint2D64f; a: double; b: double; c: double; cross: pCvPoint2D64f; - result: PInteger); cdecl; +procedure icvGetCrossPieceDirect(p_start: TCvPoint2D64f; p_end: TCvPoint2D64f; a: double; b: double; c: double; cross: pCvPoint2D64f; result: PInteger); cdecl; (* CVAPI(void) icvGetCrossPiecePiece( CvPoint2D64f p1_start,CvPoint2D64f p1_end, CvPoint2D64f p2_start,CvPoint2D64f p2_end, @@ -4116,8 +4092,7 @@ procedure icvGetPieceLength(point1: TCvPoint2D64f; point2: TCvPoint2D64f; dist: CvPoint2D64f *start,CvPoint2D64f *end, int* result); *) -procedure icvGetCrossRectDirect(imageSize: TCvSize; a: double; b: double; c: double; start: pCvPoint2D64f; end_: pCvPoint2D64f; - result: PInteger); cdecl; +procedure icvGetCrossRectDirect(imageSize: TCvSize; a: double; b: double; c: double; start: pCvPoint2D64f; end_: pCvPoint2D64f; result: PInteger); cdecl; (* CVAPI(void) icvProjectPointToImage( CvPoint3D64f point, double* camMatr,double* rotMatr,double* transVect, @@ -4145,8 +4120,8 @@ Type TicvGetQuadsTransformQuad = array [0 .. 3, 0 .. 1] of double; procedure icvGetQuadsTransform(imageSize: TCvSize; camMatr1: pdouble; rotMatr1: pdouble; transVect1: pdouble; camMatr2: pdouble; rotMatr2: pdouble; - transVect2: pdouble; warpSize: pCvSize; quad1: TicvGetQuadsTransformQuad; quad2: TicvGetQuadsTransformQuad; fundMatr: pdouble; - epipole1: pCvPoint3D64f; epipole2: pCvPoint3D64f); cdecl; + transVect2: pdouble; warpSize: pCvSize; quad1: TicvGetQuadsTransformQuad; quad2: TicvGetQuadsTransformQuad; fundMatr: pdouble; epipole1: pCvPoint3D64f; + epipole2: pCvPoint3D64f); cdecl; (* CVAPI(void) icvGetQuadsTransformStruct( CvStereoCamera* stereoCamera); *) @@ -4196,9 +4171,7 @@ function icvCreateIsometricImage(src: pIplImage; dst: pIplImage; desired_depth: (* CVAPI(void) cvDeInterlace( const CvArr* frame, CvArr* fieldEven, CvArr* fieldOdd ); *) -procedure cvDeInterlace( - - const frame: pCvArr; fieldEven: pCvArr; fieldOdd: pCvArr); cdecl; +procedure cvDeInterlace(const frame: pCvArr; fieldEven: pCvArr; fieldOdd: pCvArr); cdecl; (* CVAPI(int) icvSelectBestRt( int numImages, int* numPoints, @@ -4229,12 +4202,12 @@ procedure cvDeInterlace( (* Contour tree header *) -(* typedef struct CvContourTree - { - CV_SEQUENCE_FIELDS() - CvPoint p1; /* the first point of the binary tree root segment */ - CvPoint p2; /* the last point of the binary tree root segment */ - } CvContourTree; *) +// typedef struct CvContourTree +// { +// CV_SEQUENCE_FIELDS() +// CvPoint p1; /* the first point of the binary tree root segment */ +// CvPoint p2; /* the last point of the binary tree root segment */ +// } CvContourTree; (* Builds hierarhical representation of a contour *) @@ -4466,7 +4439,7 @@ Type TCv3dTrackerCameraInfo = record valid: TCvBool; mat: array [0 .. 3, 0 .. 3] of Single; (* maps camera coordinates to world coordinates *) - principal_point: TCvPoint2D32f; (* copied from intrinsics so this structure *) + principal_point: TCvPoint2D32f; (* copied from intrinsics so this structure *) (* has all the info we need *) end; @@ -4505,8 +4478,8 @@ function cv3dTrackerCalibrateCameras(num_cameras: Integer; camera_intrinsics: pC Cv3dTrackerTrackedObject tracked_objects[]); *) {$EXTERNALSYM cv3dTrackerLocateObjects} -function cv3dTrackerLocateObjects(num_cameras: Integer; num_objects: Integer; camera_info: pCv3dTrackerCameraInfo; - tracking_info: pCv3dTracker2dTrackedObject; tracked_objects: pCv3dTrackerTrackedObject): Integer; cdecl; +function cv3dTrackerLocateObjects(num_cameras: Integer; num_objects: Integer; camera_info: pCv3dTrackerCameraInfo; tracking_info: pCv3dTracker2dTrackedObject; + tracked_objects: pCv3dTrackerTrackedObject): Integer; cdecl; (* *************************************************************************************** @@ -4523,16 +4496,17 @@ function cv3dTrackerLocateObjects(num_cameras: Integer; num_objects: Integer; ca \*************************************************************************************** *) type - (* typedef enum CvLeeParameters - { - CV_LEE_INT = 0, - CV_LEE_FLOAT = 1, - CV_LEE_DOUBLE = 2, - CV_LEE_AUTO = -1, - CV_LEE_ERODE = 0, - CV_LEE_ZOOM = 1, - CV_LEE_NON = 2 - } CvLeeParameters; *) + // typedef enum CvLeeParameters + // { + // CV_LEE_INT = 0, + // CV_LEE_FLOAT = 1, + // CV_LEE_DOUBLE = 2, + // CV_LEE_AUTO = -1, + // CV_LEE_ERODE = 0, + // CV_LEE_ZOOM = 1, + // CV_LEE_NON = 2 + // } CvLeeParameters; + TCvLeeParameters = (CV_LEE_INT = 0, CV_LEE_FLOAT = 1, CV_LEE_DOUBLE = 2, CV_LEE_AUTO = -1, CV_LEE_ERODE = 0, CV_LEE_ZOOM = 1, CV_LEE_NON = 2); // #define CV_NEXT_VORONOISITE2D( SITE ) ((SITE)->edge[0]->site[((SITE)->edge[0]->site[0] == (SITE))]) @@ -4578,21 +4552,22 @@ type next: array [0 .. 3] of pCvVoronoiEdge2D; end; - (* typedef struct CvVoronoiEdge2D - { - CV_VORONOIEDGE2D_FIELDS() - } CvVoronoiEdge2D; *) + // typedef struct CvVoronoiEdge2D + // { + // CV_VORONOIEDGE2D_FIELDS() + // } CvVoronoiEdge2D; + TCvVoronoiEdge2D = record CV_VORONOIEDGE2D_FIELDS: TCV_VORONOIEDGE2D_FIELDS; end; - (* typedef struct CvVoronoiNode2D - { - CV_VORONOINODE2D_FIELDS() - } CvVoronoiNode2D; *) + // typedef struct CvVoronoiNode2D + // { + // CV_VORONOINODE2D_FIELDS() + // } CvVoronoiNode2D; TCvVoronoiNode2D = record // CV_VORONOINODE2D_FIELDS:TCV_VORONOINODE2D_FIELDS; - CV_SET_ELEM_FIELDS: TCV_SET_ELEM_FIELDS<TCvVoronoiNode2D>; + CV_SET_ELEM_FIELDS: {$IFDEF FPC}specialize {$ENDIF} TCV_SET_ELEM_FIELDS<TCvVoronoiNode2D>; pt: TCvPoint2D32f; radius: Single; end; @@ -4602,7 +4577,7 @@ type // CvPoint2D32f pt; \ // float radius; TCV_VORONOINODE2D_FIELDS = record - CV_SET_ELEM_FIELDS: TCV_SET_ELEM_FIELDS<TCvVoronoiNode2D>; + CV_SET_ELEM_FIELDS: {$IFDEF FPC}specialize {$ENDIF} TCV_SET_ELEM_FIELDS<TCvVoronoiNode2D>; pt: TCvPoint2D32f; radius: Single; end; @@ -4615,10 +4590,10 @@ type sites: PCvSet; end; - (* typedef struct CvVoronoiDiagram2D - { - CV_VORONOIDIAGRAM2D_FIELDS() - } CvVoronoiDiagram2D; *) + // typedef struct CvVoronoiDiagram2D + // { + // CV_VORONOIDIAGRAM2D_FIELDS() + // } CvVoronoiDiagram2D; pCvVoronoiDiagram2D = ^TCvVoronoiDiagram2D; @@ -4665,19 +4640,19 @@ procedure cvReleaseVoronoiStorage(VoronoiDiagram: pCvVoronoiDiagram2D; var pVoro *) (* struct CvLCMEdge; *) (* struct CvLCMNode; *) -(* typedef struct CvLCMEdge - { - CV_GRAPH_EDGE_FIELDS() - CvSeq* chain; - float width; - int index1; - int index2; - } CvLCMEdge; *) -(* typedef struct CvLCMNode - { - CV_GRAPH_VERTEX_FIELDS() - CvContour* contour; - } CvLCMNode; *) +// typedef struct CvLCMEdge +// { +// CV_GRAPH_EDGE_FIELDS() +// CvSeq* chain; +// float width; +// int index1; +// int index2; +// } CvLCMEdge; +// typedef struct CvLCMNode +// { +// CV_GRAPH_VERTEX_FIELDS() +// CvContour* contour; +// } CvLCMNode; (* Computes hybrid model from Voronoi Diagram *) @@ -4740,8 +4715,8 @@ Type int* lengths1, int* lengths2, int* line_count ); *) -procedure cvMakeScanlines(const matrix: pCvMatrix3; img_size: TCvSize; scanlines1: PInteger; scanlines2: PInteger; lengths1: PInteger; - lengths2: PInteger; line_count: PInteger); cdecl; +procedure cvMakeScanlines(const matrix: pCvMatrix3; img_size: TCvSize; scanlines1: PInteger; scanlines2: PInteger; lengths1: PInteger; lengths2: PInteger; + line_count: PInteger); cdecl; (* Grab pixel values from scanlines and stores them sequentially (some sort of perspective image transform) @@ -4783,8 +4758,8 @@ procedure cvFindRuns(line_count: Integer; prewarp1: puchar; prewarp2: puchar; li int* first_corr, int* second_corr); *) -procedure cvDynamicCorrespondMulti(line_count: Integer; first: PInteger; first_runs: PInteger; second: PInteger; second_runs: PInteger; - first_corr: PInteger; second_corr: PInteger); cdecl; +procedure cvDynamicCorrespondMulti(line_count: Integer; first: PInteger; first_runs: PInteger; second: PInteger; second_runs: PInteger; first_corr: PInteger; + second_corr: PInteger); cdecl; (* Finds scanline ending coordinates for some intermediate "virtual" camera position *) @@ -4796,8 +4771,7 @@ procedure cvDynamicCorrespondMulti(line_count: Integer; first: PInteger; first_r int line_count, float alpha); *) -procedure cvMakeAlphaScanlines(scanlines1: PInteger; scanlines2: PInteger; scanlinesA: PInteger; lengths: PInteger; line_count: Integer; - alpha: float); cdecl; +procedure cvMakeAlphaScanlines(scanlines1: PInteger; scanlines2: PInteger; scanlinesA: PInteger; lengths: PInteger; line_count: Integer; alpha: float); cdecl; (* Blends data of the left and right image scanlines to get pixel values of "virtual" image scanlines @@ -4842,36 +4816,36 @@ procedure cvPostWarpImage(line_count: Integer; src: puchar; src_nums: PInteger; procedure cvDeleteMoire(img: pIplImage); cdecl; Type - (* typedef struct CvConDensation - { - int MP; - int DP; - float* DynamMatr; /* Matrix of the linear Dynamics system */ - float* State; /* Vector of State */ - int SamplesNum; /* Number of the Samples */ - float** flSamples; /* arr of the Sample Vectors */ - float** flNewSamples; /* temporary array of the Sample Vectors */ - float* flConfidence; /* Confidence for each Sample */ - float* flCumulative; /* Cumulative confidence */ - float* Temp; /* Temporary vector */ - float* RandomSample; /* RandomVector to update sample set */ - struct CvRandState* RandS; /* Array of structures to generate random vectors */ - } CvConDensation; *) + // typedef struct CvConDensation + // { + // int MP; + // int DP; + // float* DynamMatr; /* Matrix of the linear Dynamics system */ + // float* State; /* Vector of State */ + // int SamplesNum; /* Number of the Samples */ + // float** flSamples; /* arr of the Sample Vectors */ + // float** flNewSamples; /* temporary array of the Sample Vectors */ + // float* flConfidence; /* Confidence for each Sample */ + // float* flCumulative; /* Cumulative confidence */ + // float* Temp; /* Temporary vector */ + // float* RandomSample; /* RandomVector to update sample set */ + // struct CvRandState* RandS; /* Array of structures to generate random vectors */ + // } CvConDensation; pCvConDensation = ^TCvConDensation; TCvConDensation = record MP: Integer; DP: Integer; - DynamMatr: PSingle; (* Matrix of the linear Dynamics system *) - state: PSingle; (* Vector of State *) - SamplesNum: Integer; (* Number of the Samples *) - flSamples: ^PSingle; (* arr of the Sample Vectors *) + DynamMatr: PSingle; (* Matrix of the linear Dynamics system *) + state: PSingle; (* Vector of State *) + SamplesNum: Integer; (* Number of the Samples *) + flSamples: ^PSingle; (* arr of the Sample Vectors *) flNewSamples: ^PSingle; (* temporary array of the Sample Vectors *) - flConfidence: PSingle; (* Confidence for each Sample *) - flCumulative: PSingle; (* Cumulative confidence *) - Temp: PSingle; (* Temporary vector *) - RandomSample: PSingle; (* RandomVector to update sample set *) - RandS: PCvRandState; (* Array of structures to generate random vectors *) + flConfidence: PSingle; (* Confidence for each Sample *) + flCumulative: PSingle; (* Cumulative confidence *) + Temp: PSingle; (* Temporary vector *) + RandomSample: PSingle; (* RandomVector to update sample set *) + RandS: PCvRandState; (* Array of structures to generate random vectors *) end; (* @@ -4904,14 +4878,14 @@ procedure cvConDensUpdateByTime(condens: pCvConDensation); cdecl; CVAPI(void) cvConDensInitSampleSet( CvConDensation* condens, CvMat* lower_bound, CvMat* upper_bound ); *) procedure cvConDensInitSampleSet(condens: pCvConDensation; lower_bound: pCvMat; upper_bound: pCvMat); cdecl; -(* CV_INLINE int iplWidth( const IplImage* img ) - { - return !img ? 0 : !img->roi ? img->width : img->roi->width; - } *) -(* CV_INLINE int iplHeight( const IplImage* img ) - { - return !img ? 0 : !img->roi ? img->height : img->roi->height; - } *) +// CV_INLINE int iplWidth( const IplImage* img ) +// { +// return !img ? 0 : !img->roi ? img->width : img->roi->width; +// } +// CV_INLINE int iplHeight( const IplImage* img ) +// { +// return !img ? 0 : !img->roi ? img->height : img->roi->height; +// } (* ***************************************************************************************\ @@ -4925,14 +4899,13 @@ procedure cvConDensInitSampleSet(condens: pCvConDensation; lower_bound: pCvMat; (* Simplified Delaunay diagram creation *) -(* CV_INLINE CvSubdiv2D* cvCreateSubdivDelaunay2D( CvRect rect, CvMemStorage* storage ) - { - CvSubdiv2D* subdiv = cvCreateSubdiv2D( CV_SEQ_KIND_SUBDIV2D, sizeof(*subdiv), - sizeof(CvSubdiv2DPoint), sizeof(CvQuadEdge2D), storage ); - - cvInitSubdivDelaunay2D( subdiv, rect ); - return subdiv; - } *) +// CV_INLINE CvSubdiv2D* cvCreateSubdivDelaunay2D( CvRect rect, CvMemStorage* storage ) +// { +// CvSubdiv2D* subdiv = cvCreateSubdiv2D( CV_SEQ_KIND_SUBDIV2D, sizeof( *subdiv), +// sizeof(CvSubdiv2DPoint), sizeof(CvQuadEdge2D), storage ); +// cvInitSubdivDelaunay2D( subdiv, rect ); +// return subdiv; +// } (* Removes all Voronoi points from the tesselation @@ -4949,34 +4922,34 @@ function cvFindNearestPoint2D(subdiv: pCvSubdiv2D; pt: TCvPoint2D32f): pCvSubdiv (* *********** Basic quad-edge navigation and operations *********** *) -(* CV_INLINE CvSubdiv2DEdge cvSubdiv2DNextEdge( CvSubdiv2DEdge edge ) - { - return CV_SUBDIV2D_NEXT_EDGE(edge); - } *) -(* CV_INLINE CvSubdiv2DEdge cvSubdiv2DRotateEdge( CvSubdiv2DEdge edge, int rotate ) - { - return (edge & ~3) + ((edge + rotate) & 3); - } *) -(* CV_INLINE CvSubdiv2DEdge cvSubdiv2DSymEdge( CvSubdiv2DEdge edge ) - { - return edge ^ 2; - } *) -(* CV_INLINE CvSubdiv2DEdge cvSubdiv2DGetEdge( CvSubdiv2DEdge edge, CvNextEdgeType type ) - { - CvQuadEdge2D* e = (CvQuadEdge2D* )(edge & ~3); - edge = e->next[(edge + (int)type) & 3]; - return (edge & ~3) + ((edge + ((int)type >> 4)) & 3); - } *) -(* CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeOrg( CvSubdiv2DEdge edge ) - { - CvQuadEdge2D* e = (CvQuadEdge2D* )(edge & ~3); - return (CvSubdiv2DPoint* )e->pt[edge & 3]; - } *) -(* CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeDst( CvSubdiv2DEdge edge ) - { - CvQuadEdge2D* e = (CvQuadEdge2D* )(edge & ~3); - return (CvSubdiv2DPoint* )e->pt[(edge + 2) & 3]; - } *) +// CV_INLINE CvSubdiv2DEdge cvSubdiv2DNextEdge( CvSubdiv2DEdge edge ) +// { +// return CV_SUBDIV2D_NEXT_EDGE(edge); +// } +// CV_INLINE CvSubdiv2DEdge cvSubdiv2DRotateEdge( CvSubdiv2DEdge edge, int rotate ) +// { +// return (edge & ~3) + ((edge + rotate) & 3); +// } +// CV_INLINE CvSubdiv2DEdge cvSubdiv2DSymEdge( CvSubdiv2DEdge edge ) +// { +// return edge ^ 2; +// } +// CV_INLINE CvSubdiv2DEdge cvSubdiv2DGetEdge( CvSubdiv2DEdge edge, CvNextEdgeType type ) +// { +// CvQuadEdge2D* e = (CvQuadEdge2D* )(edge & ~3); +// edge = e->next[(edge + (int)type) & 3]; +// return (edge & ~3) + ((edge + ((int)type >> 4)) & 3); +// } +// CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeOrg( CvSubdiv2DEdge edge ) +// { +// CvQuadEdge2D* e = (CvQuadEdge2D* )(edge & ~3); +// return (CvSubdiv2DPoint* )e->pt[edge & 3]; +// } +// CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeDst( CvSubdiv2DEdge edge ) +// { +// CvQuadEdge2D* e = (CvQuadEdge2D* )(edge & ~3); +// return (CvSubdiv2DPoint* )e->pt[(edge + 2) & 3]; +// } (* ***************************************************************************************\ * Additional operations on Subdivisions * @@ -4994,17 +4967,17 @@ procedure icvDrawMosaic(subdiv: pCvSubdiv2D; src: pIplImage; dst: pIplImage); cd *) function icvSubdiv2DCheck(subdiv: pCvSubdiv2D): Integer; cdecl; // returns squared distance between two 2D points with floating-point coordinates. -(* CV_INLINE double icvSqDist2D32f( CvPoint2D32f pt1, CvPoint2D32f pt2 ) - { - double dx = pt1.x - pt2.x; - double dy = pt1.y - pt2.y; - - return dx*dx + dy*dy; - } *) -(* CV_INLINE double cvTriangleArea( CvPoint2D32f a, CvPoint2D32f b, CvPoint2D32f c ) - { - return ((double)b.x - a.x) * ((double)c.y - a.y) - ((double)b.y - a.y) * ((double)c.x - a.x); - } *) +// CV_INLINE double icvSqDist2D32f( CvPoint2D32f pt1, CvPoint2D32f pt2 ) +// { +// double dx = pt1.x - pt2.x; +// double dy = pt1.y - pt2.y; +// +// return dx*dx + dy*dy; +// } +// CV_INLINE double cvTriangleArea( CvPoint2D32f a, CvPoint2D32f b, CvPoint2D32f c ) +// { +// return ((double)b.x - a.x) * ((double)c.y - a.y) - ((double)b.y - a.y) * ((double)c.x - a.x); +// } (* Constructs kd-tree from set of feature descriptors @@ -5020,8 +4993,7 @@ function cvCreateKDTree(desc: pCvMat): pCvFeatureTree; cdecl; const double rho CV_DEFAULT(.7), const double tau CV_DEFAULT(.1) ); *) -function cvCreateSpillTree(const raw_data: pCvMat; const naive: Integer = 50; const rho: double = 0.7; const tau: double = 0.1) - : pCvFeatureTree; cdecl; +function cvCreateSpillTree(const raw_data: pCvMat; const naive: Integer = 50; const rho: double = 0.7; const tau: double = 0.1): pCvFeatureTree; cdecl; (* Release feature tree *) @@ -5068,8 +5040,8 @@ function cvCreateLSH(ops: pCvLSHOperations; d: Integer; L: Integer { =10 }; K: I int type CV_DEFAULT(CV_64FC1), double r CV_DEFAULT(4), int64 seed CV_DEFAULT(-1)); *) -function cvCreateMemoryLSH(d: Integer; n: Integer; L: Integer { =10 }; K: Integer { =10 }; type_: Integer { =CV_64FC1 }; r: double { =4 }; - seed: int64 { =-1 } ): pCvLSH; cdecl; +function cvCreateMemoryLSH(d: Integer; n: Integer; L: Integer { =10 }; K: Integer { =10 }; type_: Integer { =CV_64FC1 }; r: double { =4 }; seed: int64 { =-1 } ) + : pCvLSH; cdecl; (* Free the given LSH structure. *) @@ -5111,25 +5083,25 @@ procedure cvLSHQuery(lsh: pCvLSH; const query_points: pCvMat; indices: pCvMat; d Kolmogorov-Zabin stereo-correspondence algorithm (a.k.a. KZ1) *) // #define CV_STEREO_GC_OCCLUDED SHRT_MAX -(* typedef struct CvStereoGCState - { - int Ithreshold; - int interactionRadius; - float K, lambda, lambda1, lambda2; - int occlusionCost; - int minDisparity; - int numberOfDisparities; - int maxIters; - - CvMat* left; - CvMat* right; - CvMat* dispLeft; - CvMat* dispRight; - CvMat* ptrLeft; - CvMat* ptrRight; - CvMat* vtxBuf; - CvMat* edgeBuf; - } CvStereoGCState; *) +// typedef struct CvStereoGCState +// { +// int Ithreshold; +// int interactionRadius; +// float K, lambda, lambda1, lambda2; +// int occlusionCost; +// int minDisparity; +// int numberOfDisparities; +// int maxIters; +// +// CvMat* left; +// CvMat* right; +// CvMat* dispLeft; +// CvMat* dispRight; +// CvMat* ptrLeft; +// CvMat* ptrRight; +// CvMat* vtxBuf; +// CvMat* edgeBuf; +// } CvStereoGCState; (* Calculates optical flow for 2 images using classical Lucas & Kanade algorithm @@ -5148,8 +5120,8 @@ procedure cvCalcOpticalFlowLK(const prev: pCvArr; const curr: pCvArr; win_size: CvSize max_range, int use_previous, CvArr* velx, CvArr* vely ); *) -procedure cvCalcOpticalFlowBM(const prev: pCvArr; const curr: pCvArr; block_size: TCvSize; shift_size: TCvSize; max_range: TCvSize; - use_previous: Integer; velx: pCvArr; vely: pCvArr); cdecl; +procedure cvCalcOpticalFlowBM(const prev: pCvArr; const curr: pCvArr; block_size: TCvSize; shift_size: TCvSize; max_range: TCvSize; use_previous: Integer; + velx: pCvArr; vely: pCvArr); cdecl; (* Calculates Optical flow for 2 images using Horn & Schunck algorithm *) @@ -5212,10 +5184,10 @@ procedure cvCalcOpticalFlowHS(const prev: pCvArr; const curr: pCvArr; use_previo // int layer_count; /* can be zero */ \ // CvMemStorage* storage; /*storage for foreground_regions*/ \ // CvSeq* foreground_regions /*foreground object contours*/ -(* typedef struct CvBGStatModel - { - CV_BG_STAT_MODEL_FIELDS(); - } CvBGStatModel; *) +// typedef struct CvBGStatModel +// { +// CV_BG_STAT_MODEL_FIELDS(); +// } CvBGStatModel; // Performs FG post-processing using segmentation // (all pixels of a region will be classified as foreground if majority of pixels of the region are FG). @@ -5251,58 +5223,58 @@ function cvChangeDetection(prev_frame: pIplImage; curr_frame: pIplImage; change_ * color CHANGES we've seen at a given background pixel. *) -(* typedef struct CvFGDStatModelParams - { - int Lc; /* Quantized levels per 'color' component. Power of two, typically 32, 64 or 128. */ - int N1c; /* Number of color vectors used to model normal background color variation at a given pixel. */ - int N2c; /* Number of color vectors retained at given pixel. Must be > N1c, typically ~ 5/3 of N1c. */ - /* Used to allow the first N1c vectors to adapt over time to changing background. */ - - int Lcc; /* Quantized levels per 'color co-occurrence' component. Power of two, typically 16, 32 or 64. */ - int N1cc; /* Number of color co-occurrence vectors used to model normal background color variation at a given pixel. */ - int N2cc; /* Number of color co-occurrence vectors retained at given pixel. Must be > N1cc, typically ~ 5/3 of N1cc. */ - /* Used to allow the first N1cc vectors to adapt over time to changing background. */ - - int is_obj_without_holes;/* If TRUE we ignore holes within foreground blobs. Defaults to TRUE. */ - int perform_morphing; /* Number of erode-dilate-erode foreground-blob cleanup iterations. */ - /* These erase one-pixel junk blobs and merge almost-touching blobs. Default value is 1. */ - - float alpha1; /* How quickly we forget old background pixel values seen. Typically set to 0.1 */ - float alpha2; /* "Controls speed of feature learning". Depends on T. Typical value circa 0.005. */ - float alpha3; /* Alternate to alpha2, used (e.g.) for quicker initial convergence. Typical value 0.1. */ - - float delta; /* Affects color and color co-occurrence quantization, typically set to 2. */ - float T; /* "A percentage value which determines when new features can be recognized as new background." (Typically 0.9).*/ - float minArea; /* Discard foreground blobs whose bounding box is smaller than this threshold. */ - } CvFGDStatModelParams; *) -(* typedef struct CvBGPixelCStatTable - { - float Pv, Pvb; - uchar v[3]; - } CvBGPixelCStatTable; *) -(* typedef struct CvBGPixelCCStatTable - { - float Pv, Pvb; - uchar v[6]; - } CvBGPixelCCStatTable; *) -(* typedef struct CvBGPixelStat - { - float Pbc; - float Pbcc; - CvBGPixelCStatTable* ctable; - CvBGPixelCCStatTable* cctable; - uchar is_trained_st_model; - uchar is_trained_dyn_model; - } CvBGPixelStat; *) -(* typedef struct CvFGDStatModel - { - CV_BG_STAT_MODEL_FIELDS(); - CvBGPixelStat* pixel_stat; - IplImage* Ftd; - IplImage* Fbd; - IplImage* prev_frame; - CvFGDStatModelParams params; - } CvFGDStatModel; *) +// typedef struct CvFGDStatModelParams +// { +// int Lc; /* Quantized levels per 'color' component. Power of two, typically 32, 64 or 128. */ +// int N1c; /* Number of color vectors used to model normal background color variation at a given pixel. */ +// int N2c; /* Number of color vectors retained at given pixel. Must be > N1c, typically ~ 5/3 of N1c. */ +// /* Used to allow the first N1c vectors to adapt over time to changing background. */ +// +// int Lcc; /* Quantized levels per 'color co-occurrence' component. Power of two, typically 16, 32 or 64. */ +// int N1cc; /* Number of color co-occurrence vectors used to model normal background color variation at a given pixel. */ +// int N2cc; /* Number of color co-occurrence vectors retained at given pixel. Must be > N1cc, typically ~ 5/3 of N1cc. */ +// /* Used to allow the first N1cc vectors to adapt over time to changing background. */ +// +// int is_obj_without_holes;/* If TRUE we ignore holes within foreground blobs. Defaults to TRUE. */ +// int perform_morphing; /* Number of erode-dilate-erode foreground-blob cleanup iterations. */ +// /* These erase one-pixel junk blobs and merge almost-touching blobs. Default value is 1. */ +// +// float alpha1; /* How quickly we forget old background pixel values seen. Typically set to 0.1 */ +// float alpha2; /* "Controls speed of feature learning". Depends on T. Typical value circa 0.005. */ +// float alpha3; /* Alternate to alpha2, used (e.g.) for quicker initial convergence. Typical value 0.1. */ +// +// float delta; /* Affects color and color co-occurrence quantization, typically set to 2. */ +// float T; /* "A percentage value which determines when new features can be recognized as new background." (Typically 0.9).*/ +// float minArea; /* Discard foreground blobs whose bounding box is smaller than this threshold. */ +// } CvFGDStatModelParams; +// typedef struct CvBGPixelCStatTable +// { +// float Pv, Pvb; +// uchar v[3]; +// } CvBGPixelCStatTable; +// typedef struct CvBGPixelCCStatTable +// { +// float Pv, Pvb; +// uchar v[6]; +// } CvBGPixelCCStatTable; +// typedef struct CvBGPixelStat +// { +// float Pbc; +// float Pbcc; +// CvBGPixelCStatTable* ctable; +// CvBGPixelCCStatTable* cctable; +// uchar is_trained_st_model; +// uchar is_trained_dyn_model; +// } CvBGPixelStat; +// typedef struct CvFGDStatModel +// { +// CV_BG_STAT_MODEL_FIELDS(); +// CvBGPixelStat* pixel_stat; +// IplImage* Ftd; +// IplImage* Fbd; +// IplImage* prev_frame; +// CvFGDStatModelParams params; +// } CvFGDStatModel; (* @@ -5329,54 +5301,54 @@ function cvChangeDetection(prev_frame: pIplImage; curr_frame: pIplImage; change_ // #define CV_BGFG_MOG_SIGMA_INIT 30 // #define CV_BGFG_MOG_MINAREA 15.f // #define CV_BGFG_MOG_NCOLORS 3 -(* typedef struct CvGaussBGStatModelParams - { - int win_size; /* = 1/alpha */ - int n_gauss; - double bg_threshold, std_threshold, minArea; - double weight_init, variance_init; - }CvGaussBGStatModelParams; *) -(* typedef struct CvGaussBGValues - { - int match_sum; - double weight; - double variance[CV_BGFG_MOG_NCOLORS]; - double mean[CV_BGFG_MOG_NCOLORS]; - } CvGaussBGValues; *) -(* typedef struct CvGaussBGPoint - { - CvGaussBGValues* g_values; - } CvGaussBGPoint; *) -(* typedef struct CvGaussBGModel - { - CV_BG_STAT_MODEL_FIELDS(); - CvGaussBGStatModelParams params; - CvGaussBGPoint* g_point; - int countFrames; - void* mog; - } CvGaussBGModel; *) +// typedef struct CvGaussBGStatModelParams +// { +// int win_size; /* = 1/alpha */ +// int n_gauss; +// double bg_threshold, std_threshold, minArea; +// double weight_init, variance_init; +// }CvGaussBGStatModelParams; +// typedef struct CvGaussBGValues +// { +// int match_sum; +// double weight; +// double variance[CV_BGFG_MOG_NCOLORS]; +// double mean[CV_BGFG_MOG_NCOLORS]; +// } CvGaussBGValues; +// typedef struct CvGaussBGPoint +// { +// CvGaussBGValues* g_values; +// } CvGaussBGPoint; +// typedef struct CvGaussBGModel +// { +// CV_BG_STAT_MODEL_FIELDS(); +// CvGaussBGStatModelParams params; +// CvGaussBGPoint* g_point; +// int countFrames; +// void* mog; +// } CvGaussBGModel; -(* typedef struct CvBGCodeBookElem - { - struct CvBGCodeBookElem* next; - int tLastUpdate; - int stale; - uchar boxMin[3]; - uchar boxMax[3]; - uchar learnMin[3]; - uchar learnMax[3]; - } CvBGCodeBookElem; *) -(* typedef struct CvBGCodeBookModel - { - CvSize size; - int t; - uchar cbBounds[3]; - uchar modMin[3]; - uchar modMax[3]; - CvBGCodeBookElem** cbmap; - CvMemStorage* storage; - CvBGCodeBookElem* freeList; - } CvBGCodeBookModel; *) +// typedef struct CvBGCodeBookElem +// { +// struct CvBGCodeBookElem* next; +// int tLastUpdate; +// int stale; +// uchar boxMin[3]; +// uchar boxMax[3]; +// uchar learnMin[3]; +// uchar learnMax[3]; +// } CvBGCodeBookElem; +// typedef struct CvBGCodeBookModel +// { +// CvSize size; +// int t; +// uchar cbBounds[3]; +// uchar modMin[3]; +// uchar modMax[3]; +// CvBGCodeBookElem** cbmap; +// CvMemStorage* storage; +// CvBGCodeBookElem* freeList; +// } CvBGCodeBookModel; implementation @@ -5386,11 +5358,12 @@ function cvSubdiv2DEdgeOrg(edge: TCvSubdiv2DEdge): pCvSubdiv2DPoint; inline; Var e: pCvQuadEdge2D; begin - // CvQuadEdge2D* e = (CvQuadEdge2D*)(edge & ~3); + // CvQuadEdge2D* e = (CvQuadEdge2D* )(edge & ~3); e := pCvQuadEdge2D(edge and (not 3)); - // return (CvSubdiv2DPoint*)e->pt[edge & 3]; + // return (CvSubdiv2DPoint* )e->pt[edge & 3]; result := pCvSubdiv2DPoint(e^.pt[edge and 3]); end; + function cvSubdiv2DEdgeDst(edge: TCvSubdiv2DEdge): pCvSubdiv2DPoint; Var e: pCvQuadEdge2D; @@ -5419,154 +5392,197 @@ begin result := (edge and (not 3)) + ((edge + rotate) and 3); end; -function cvCreateStereoGCState; external legacy_lib; -procedure cvFindStereoCorrespondenceGC; external legacy_lib; -procedure cvReleaseStereoGCState; external legacy_lib; -procedure cvSnakeImage; external legacy_lib; -function cvCreateSubdiv2D; external legacy_lib; -procedure cvInitSubdivDelaunay2D; external legacy_lib; -function cvSubdiv2DLocate; external legacy_lib; -procedure cvCalcSubdivVoronoi2D; external legacy_lib; -function cvSubdivDelaunay2DInsert; external legacy_lib; -function cvCreateGaussianBGModel; external legacy_lib; -function cvUpdateBGStatModel; external legacy_lib; -procedure cvReleaseBGStatModel; external legacy_lib; -function cvCreateFGDStatModel; external legacy_lib; -function cvCreateBGCodeBookModel; external legacy_lib; -procedure cvReleaseBGCodeBookModel; external legacy_lib; -procedure cvBGCodeBookUpdate; external legacy_lib; -function cvBGCodeBookDiff; external legacy_lib; -procedure cvBGCodeBookClearStale; external legacy_lib; -function cvSegmentFGMask; external legacy_lib; -procedure cvPyrSegmentation; external legacy_lib; -procedure cvCalcEigenObjects; external legacy_lib; -procedure cvEigenDecomposite; external legacy_lib; -function cvSegmentImage; external legacy_lib; -procedure cvCalcCovarMatrixEx; external legacy_lib; -function cvCalcDecompCoeff; external legacy_lib; -procedure cvEigenProjection; external legacy_lib; -function icvCreate1DHMM; external legacy_lib; -function icvRelease1DHMM; external legacy_lib; -function icvUniform1DSegm; external legacy_lib; -function icvInit1DMixSegm; external legacy_lib; -function icvEstimate1DHMMStateParams; external legacy_lib; -function icvEstimate1DObsProb; external legacy_lib; -function icvEstimate1DTransProb; external legacy_lib; -function icvViterbi; external legacy_lib; -function icv1DMixSegmL2; external legacy_lib; -function cvCreate2DHMM; external legacy_lib; -procedure cvRelease2DHMM; external legacy_lib; -function cvCreateObsInfo; external legacy_lib; -procedure cvReleaseObsInfo; external legacy_lib; -procedure cvImgToObs_DCT; external legacy_lib; -procedure cvUniformImgSegm; external legacy_lib; -procedure cvInitMixSegm; external legacy_lib; -procedure cvEstimateHMMStateParams; external legacy_lib; -procedure cvEstimateTransProb; external legacy_lib; -procedure cvEstimateObsProb; external legacy_lib; -function cvEViterbi; external legacy_lib; -procedure cvMixSegmL2; external legacy_lib; -procedure cvCreateHandMask; external legacy_lib; -procedure cvFindHandRegion; external legacy_lib; -procedure cvFindHandRegionA; external legacy_lib; -procedure cvCalcImageHomography; external legacy_lib; -procedure cvCalcPGH; external legacy_lib; -function cvFindDominantPoints; external legacy_lib; -procedure cvFindStereoCorrespondence; external legacy_lib; -function icvConvertWarpCoordinates; external legacy_lib; -function icvGetSymPoint3D; external legacy_lib; -procedure icvGetPieceLength3D; external legacy_lib; -function icvCompute3DPoint; external legacy_lib; -function icvCreateConvertMatrVect; external legacy_lib; -function icvConvertPointSystem; external legacy_lib; -function icvComputeCoeffForStereo; external legacy_lib; -function icvGetCrossPieceVector; external legacy_lib; -function icvGetCrossLineDirect; external legacy_lib; -function icvDefinePointPosition; external legacy_lib; -function icvStereoCalibration; external legacy_lib; -function icvComputeRestStereoParams; external legacy_lib; -procedure cvComputePerspectiveMap; external legacy_lib; -function icvComCoeffForLine; external legacy_lib; -function icvGetDirectionForPoint; external legacy_lib; -function icvGetCrossLines; external legacy_lib; -function icvComputeStereoLineCoeffs; external legacy_lib; -function icvGetAngleLine; external legacy_lib; -procedure icvGetCoefForPiece; external legacy_lib; -procedure icvComputeeInfiniteProject1; external legacy_lib; -procedure icvComputeeInfiniteProject2; external legacy_lib; -procedure icvGetCrossDirectDirect; external legacy_lib; -procedure icvGetCrossPieceDirect; external legacy_lib; -procedure icvGetCrossPiecePiece; external legacy_lib; -procedure icvGetPieceLength; external legacy_lib; -procedure icvGetCrossRectDirect; external legacy_lib; -procedure icvProjectPointToImage; external legacy_lib; -procedure icvGetQuadsTransform; external legacy_lib; -procedure icvGetQuadsTransformStruct; external legacy_lib; -procedure icvComputeStereoParamsForCameras; external legacy_lib; -procedure icvGetCutPiece; external legacy_lib; -procedure icvGetMiddleAnglePoint; external legacy_lib; -procedure icvGetNormalDirect; external legacy_lib; -function icvGetVect; external legacy_lib; -procedure icvProjectPointToDirect; external legacy_lib; -procedure icvGetDistanceFromPointToDirect; external legacy_lib; -function icvCreateIsometricImage; external legacy_lib; -procedure cvDeInterlace; external legacy_lib; -function cvCreateContourTree; external legacy_lib; -function cvContourFromContourTree; external legacy_lib; -function cvMatchContourTrees; external legacy_lib; -function cvCalcContoursCorrespondence; external legacy_lib; -function cvMorphContours; external legacy_lib; -function cvCreateGLCM; external legacy_lib; -procedure cvReleaseGLCM; external legacy_lib; -procedure cvCreateGLCMDescriptors; external legacy_lib; -function cvGetGLCMDescriptor; external legacy_lib; -procedure cvGetGLCMDescriptorStatistics; external legacy_lib; -function cvCreateGLCMImage; external legacy_lib; -function cvInitFaceTracker; external legacy_lib; -function cvTrackFace; external legacy_lib; -procedure cvReleaseFaceTracker; external legacy_lib; -function cvFindFace; external legacy_lib; -function cvPostBoostingFindFace; external legacy_lib; -function cv3dTrackerCalibrateCameras; external legacy_lib; -function cv3dTrackerLocateObjects; external legacy_lib; -function cvVoronoiDiagramFromContour; external legacy_lib; -function cvVoronoiDiagramFromImage; external legacy_lib; -procedure cvReleaseVoronoiStorage; external legacy_lib; -function cvLinearContorModelFromVoronoiDiagram; external legacy_lib; -function cvReleaseLinearContorModelStorage; external legacy_lib; -procedure cvInitPerspectiveTransform; external legacy_lib; -procedure cvMakeScanlines; external legacy_lib; -procedure cvPreWarpImage; external legacy_lib; -procedure cvFindRuns; external legacy_lib; -procedure cvDynamicCorrespondMulti; external legacy_lib; -procedure cvMakeAlphaScanlines; external legacy_lib; -procedure cvMorphEpilinesMulti; external legacy_lib; -procedure cvPostWarpImage; external legacy_lib; -procedure cvDeleteMoire; external legacy_lib; -function cvCreateConDensation; external legacy_lib; -procedure cvReleaseConDensation; external legacy_lib; -procedure cvConDensUpdateByTime; external legacy_lib; -procedure cvConDensInitSampleSet; external legacy_lib; -procedure cvClearSubdivVoronoi2D; external legacy_lib; -function cvFindNearestPoint2D; external legacy_lib; -procedure icvDrawMosaic; external legacy_lib; -function icvSubdiv2DCheck; external legacy_lib; -function cvCreateKDTree; external legacy_lib; -function cvCreateSpillTree; external legacy_lib; -procedure cvReleaseFeatureTree; external legacy_lib; -procedure cvFindFeatures; external legacy_lib; -function cvFindFeaturesBoxed; external legacy_lib; -function cvCreateLSH; external legacy_lib; -function cvCreateMemoryLSH; external legacy_lib; -procedure cvReleaseLSH; external legacy_lib; -function LSHSize; external legacy_lib; -procedure cvLSHAdd; external legacy_lib; -procedure cvLSHRemove; external legacy_lib; -procedure cvLSHQuery; external legacy_lib; -procedure cvCalcOpticalFlowLK; external legacy_lib; -procedure cvCalcOpticalFlowBM; external legacy_lib; -procedure cvCalcOpticalFlowHS; external legacy_lib; -procedure cvRefineForegroundMaskBySegm; external legacy_lib; -function cvChangeDetection; external legacy_lib; +function cvCreateStereoGCState(numberOfDisparities: Integer; maxIters: Integer): pCvStereoGCState; cdecl; external legacy_lib; +procedure cvFindStereoCorrespondenceGC(const left: pIplImage; const right: pIplImage; disparityLeft: pCvMat; disparityRight: pCvMat; state: pCvStereoGCState; + useDisparityGuess: Integer = 0); cdecl; external legacy_lib; +procedure cvReleaseStereoGCState(Var state: pCvStereoGCState); cdecl; external legacy_lib; +procedure cvSnakeImage(const image: pIplImage; points: pCvPointArray; length: Integer; alpha: PSingle; beta: PSingle; gamma: PSingle; coeff_usage: Integer; + win: TCvSize; criteria: TCvTermCriteria; calc_gradient: Integer = 1); cdecl; external legacy_lib; +function cvCreateSubdiv2D(subdiv_type: Integer; header_size: Integer; vtx_size: Integer; quadedge_size: Integer; storage: pCvMemStorage): pCvSubdiv2D; cdecl; + external legacy_lib; +procedure cvInitSubdivDelaunay2D(subdiv: pCvSubdiv2D; rect: TCvRect); cdecl; external legacy_lib; +function cvSubdiv2DLocate(subdiv: pCvSubdiv2D; pt: TCvPoint2D32f; edge: pCvSubdiv2DEdge; vertex: pCvSubdiv2DPoint = nil): TCvSubdiv2DPointLocation; cdecl; + external legacy_lib; +procedure cvCalcSubdivVoronoi2D(subdiv: pCvSubdiv2D); cdecl; external legacy_lib; +function cvSubdivDelaunay2DInsert(subdiv: pCvSubdiv2D; pt: TCvPoint2D32f): pCvSubdiv2DPoint; cdecl; external legacy_lib; +function cvCreateGaussianBGModel(first_frame: pIplImage; parameters: pCvGaussBGStatModelParams = nil): pCvBGStatModel; cdecl; external legacy_lib; +function cvUpdateBGStatModel(current_frame: pIplImage; bg_model: pCvBGStatModel; learningRate: double = -1): Integer; cdecl; external legacy_lib; +procedure cvReleaseBGStatModel(Var bg_model: pCvBGStatModel); cdecl; external legacy_lib; +function cvCreateFGDStatModel(first_frame: pIplImage; parameters: pCvFGDStatModelParams = nil): pCvBGStatModel; cdecl; external legacy_lib; +function cvCreateBGCodeBookModel: pCvBGCodeBookModel; cdecl; external legacy_lib; +procedure cvReleaseBGCodeBookModel(model: pCvBGCodeBookModel); cdecl; external legacy_lib; +procedure cvBGCodeBookUpdate(model: pCvBGCodeBookModel; const image: pIplImage; roi: TCvRect { =CV_DEFAULT(cvRect(0,0,0,0)) }; const mask: pCvArr { =0 } ); + cdecl; external legacy_lib; +function cvBGCodeBookDiff(const model: pCvBGCodeBookModel; const image: pCvArr; fgmask: pCvArr; roi: TCvRect { = cvRect(0,0,0,0) } ): Integer; cdecl; + external legacy_lib; +procedure cvBGCodeBookClearStale(model: pCvBGCodeBookModel; staleThresh: Integer; roi: TCvRect { =cvRect(0,0,0,0) }; const mask: pCvArr = nil); cdecl; + external legacy_lib; +function cvSegmentFGMask(fgmask: pCvArr; poly1Hull0: Integer { =1 }; perimScale: Single { = 4 }; storage: pCvMemStorage { =nil }; + offset: TCvPoint { =cvPoint(0,0) } ): pCvSeq; cdecl; external legacy_lib; +procedure cvPyrSegmentation(src: pIplImage; dst: pIplImage; storage: pCvMemStorage; + var comp: pCvSeq; level: Integer; threshold1: double; threshold2: double); cdecl; external legacy_lib; +procedure cvCalcEigenObjects(nObjects: Integer; input: pointer; output: pointer; ioFlags: Integer; ioBufSize: Integer; userData: pointer; + calcLimit: pCvTermCriteria; avg: pIplImage; eigVals: pFloat); cdecl; external legacy_lib; +procedure cvEigenDecomposite(obj: pIplImage; nEigObjs: Integer; eigInput: pointer; ioFlags: Integer; userData: pointer; avg: pIplImage; coeffs: pFloat); cdecl; external legacy_lib; +function cvSegmentImage(const srcarr: pCvArr; dstarr: pCvArr; canny_threshold: double; ffill_threshold: double; storage: pCvMemStorage): pCvSeq; cdecl; external legacy_lib; +procedure cvCalcCovarMatrixEx(nObjects: Integer; input: pointer; ioFlags: Integer; ioBufSize: Integer; buffer: pByte; userData: pointer; avg: pIplImage; + var covarMatrix: Single); cdecl; external legacy_lib; +function cvCalcDecompCoeff(obj: pIplImage; eigObj: pIplImage; avg: pIplImage): double; cdecl; external legacy_lib; +procedure cvEigenProjection(eigInput: pointer; nEigObjs: Integer; ioFlags: Integer; userData: pointer; coeffs: PSingle; avg: pIplImage; proj: pIplImage); cdecl; external legacy_lib; +function icvCreate1DHMM(var this_hmm: pCvEHMM; state_number: Integer; Var num_mix: Integer; obs_size: Integer): Integer; cdecl; external legacy_lib; +function icvRelease1DHMM(var phmm: pCvEHMM): Integer; cdecl; external legacy_lib; +function icvUniform1DSegm(var obs_info: TCv1DObsInfo; var hmm: TCvEHMM): Integer; cdecl; external legacy_lib; +function icvInit1DMixSegm(var obs_info_array: pCv1DObsInfo; num_img: Integer; var hmm: TCvEHMM): Integer; cdecl; external legacy_lib; +function icvEstimate1DHMMStateParams(var obs_info_array: pCvImgObsInfo; num_img: Integer; var hmm: TCvEHMM): Integer; cdecl; external legacy_lib; +function icvEstimate1DObsProb(var obs_info: TCvImgObsInfo; var hmm: TCvEHMM): Integer; cdecl; external legacy_lib; +function icvEstimate1DTransProb(var obs_info_array: pCv1DObsInfo; num_seq: Integer; var hmm: TCvEHMM): Integer; cdecl; external legacy_lib; +function icvViterbi(var obs_info: TCv1DObsInfo; var hmm: TCvEHMM): Single; cdecl; external legacy_lib; +function icv1DMixSegmL2(var obs_info_array: pCvImgObsInfo; num_img: Integer; var hmm: TCvEHMM): Integer; cdecl; external legacy_lib; +function cvCreate2DHMM(Var stateNumber: Integer; Var numMix: Integer; obsSize: Integer): pCvEHMM; cdecl; external legacy_lib; +procedure cvRelease2DHMM(var hmm: pCvEHMM); cdecl; external legacy_lib; +function cvCreateObsInfo(numObs: TCvSize; obsSize: Integer): pCvImgObsInfo; cdecl; external legacy_lib; +procedure cvReleaseObsInfo(var obs_info: pCvImgObsInfo); cdecl; external legacy_lib; +procedure cvImgToObs_DCT(const arr: pCvArr; var obs: Single; dctSize: TCvSize; obsSize: TCvSize; delta: TCvSize); cdecl; external legacy_lib; +procedure cvUniformImgSegm(var obs_info: TCvImgObsInfo; var ehmm: TCvEHMM); cdecl; external legacy_lib; +procedure cvInitMixSegm(var obs_info_array: pCvImgObsInfo; num_img: Integer; var hmm: TCvEHMM); cdecl; external legacy_lib; +procedure cvEstimateHMMStateParams(var obs_info_array: pCvImgObsInfo; num_img: Integer; var hmm: TCvEHMM); cdecl; external legacy_lib; +procedure cvEstimateTransProb(var obs_info_array: pCvImgObsInfo; num_img: Integer; var hmm: TCvEHMM); cdecl; external legacy_lib; +procedure cvEstimateObsProb(var obs_info: TCvImgObsInfo; var hmm: TCvEHMM); cdecl; external legacy_lib; +function cvEViterbi(var obs_info: TCvImgObsInfo; var hmm: TCvEHMM): Single; cdecl; external legacy_lib; +procedure cvMixSegmL2(var obs_info_array: pCvImgObsInfo; num_img: Integer; var hmm: TCvEHMM); cdecl; external legacy_lib; +procedure cvCreateHandMask(var hand_points: TCvSeq; var img_mask: TIplImage; var roi: TCvRect); cdecl; external legacy_lib; +procedure cvFindHandRegion(var points: TCvPoint3D32f; count: Integer; var indexs: TCvSeq; var line: Single; size: TCvSize2D32f; flag: Integer; + var center: TCvPoint3D32f; var storage: TCvMemStorage; var numbers: pCvSeq); cdecl; external legacy_lib; +procedure cvFindHandRegionA(var points: TCvPoint3D32f; count: Integer; var indexs: TCvSeq; var line: Single; size: TCvSize2D32f; jc: Integer; + var center: TCvPoint3D32f; var storage: TCvMemStorage; var numbers: pCvSeq); cdecl; external legacy_lib; +procedure cvCalcImageHomography(var line: Single; var center: TCvPoint3D32f; var intrinsic: Single; var homography: Single); cdecl; external legacy_lib; +procedure cvCalcPGH(const contour: pCvSeq; var hist: TCvHistogram); cdecl; external legacy_lib; +function cvFindDominantPoints(contour: pCvSeq; storage: pCvMemStorage; method: Integer = CV_DOMINANT_IPAN; parameter1: double = 0; parameter2: double = 0; + parameter3: double = 0; parameter4: double = 0): pCvSeq; cdecl; external legacy_lib; +procedure cvFindStereoCorrespondence(const leftImage: pCvArr; const rightImage: pCvArr; mode: Integer; dispImage: pCvArr; maxDisparity: Integer; + param1: double = CV_UNDEF_SC_PARAM; param2: double = CV_UNDEF_SC_PARAM; param3: double = CV_UNDEF_SC_PARAM; param4: double = CV_UNDEF_SC_PARAM; + param5: double = CV_UNDEF_SC_PARAM); cdecl; external legacy_lib; +function icvConvertWarpCoordinates(coeffs: TicvConvertWarpCoordinatesCoeff; cameraPoint: pCvPoint2D32f; warpPoint: pCvPoint2D32f; direction: Integer) + : Integer; cdecl; external legacy_lib; +function icvGetSymPoint3D(pointCorner: TCvPoint3D64f; point1: TCvPoint3D64f; point2: TCvPoint3D64f; pointSym2: pCvPoint3D64f): Integer; cdecl; external legacy_lib; +procedure icvGetPieceLength3D(point1: TCvPoint3D64f; point2: TCvPoint3D64f; dist: pdouble); cdecl; external legacy_lib; +function icvCompute3DPoint(alpha: double; betta: double; coeffs: pCvStereoLineCoeff; point: pCvPoint3D64f): Integer; cdecl; external legacy_lib; +function icvCreateConvertMatrVect(rotMatr1: pdouble; transVect1: pdouble; rotMatr2: pdouble; transVect2: pdouble; convRotMatr: pdouble; convTransVect: pdouble) + : Integer; cdecl; external legacy_lib; +function icvConvertPointSystem(M2: TCvPoint3D64f; M1: pCvPoint3D64f; rotMatr: pdouble; transVect: pdouble): Integer; cdecl; external legacy_lib; +function icvComputeCoeffForStereo(stereoCamera: pCvStereoCamera): Integer; cdecl; external legacy_lib; +function icvGetCrossPieceVector(p1_start: TCvPoint2D32f; p1_end: TCvPoint2D32f; v2_start: TCvPoint2D32f; v2_end: TCvPoint2D32f; cross: pCvPoint2D32f) + : Integer; cdecl; external legacy_lib; +function icvGetCrossLineDirect(p1: TCvPoint2D32f; p2: TCvPoint2D32f; a: float; b: float; c: float; cross: pCvPoint2D32f): Integer; cdecl; external legacy_lib; +function icvDefinePointPosition(point1: TCvPoint2D32f; point2: TCvPoint2D32f; point: TCvPoint2D32f): float; cdecl; external legacy_lib; +function icvStereoCalibration(numImages: Integer; nums: PInteger; imageSize: TCvSize; imagePoints1: pCvPoint2D32f; imagePoints2: pCvPoint2D32f; + objectPoints: pCvPoint3D32f; stereoparams: pCvStereoCamera): Integer; cdecl; external legacy_lib; +function icvComputeRestStereoParams(stereoparams: pCvStereoCamera): Integer; cdecl; external legacy_lib; +procedure cvComputePerspectiveMap(const coeffs: TicvConvertWarpCoordinatesCoeff; rectMapX: pCvArr; rectMapY: pCvArr); cdecl; external legacy_lib; +function icvComCoeffForLine(point1: TCvPoint2D64f; point2: TCvPoint2D64f; point3: TCvPoint2D64f; point4: TCvPoint2D64f; camMatr1: pdouble; rotMatr1: pdouble; + transVect1: pdouble; camMatr2: pdouble; rotMatr2: pdouble; transVect2: pdouble; coeffs: pCvStereoLineCoeff; needSwapCameras: PInteger): Integer; cdecl; external legacy_lib; +function icvGetDirectionForPoint(point: TCvPoint2D64f; camMatr: pdouble; direct: pCvPoint3D64f): Integer; cdecl; external legacy_lib; +function icvGetCrossLines(point11: TCvPoint3D64f; point12: TCvPoint3D64f; point21: TCvPoint3D64f; point22: TCvPoint3D64f; midPoint: pCvPoint3D64f) + : Integer; cdecl; external legacy_lib; +function icvComputeStereoLineCoeffs(pointA: TCvPoint3D64f; pointB: TCvPoint3D64f; pointCam1: TCvPoint3D64f; gamma: double; coeffs: pCvStereoLineCoeff) + : Integer; cdecl; external legacy_lib; +function icvGetAngleLine(startPoint: TCvPoint2D64f; imageSize: TCvSize; point1: pCvPoint2D64f; point2: pCvPoint2D64f): Integer; cdecl; external legacy_lib; +procedure icvGetCoefForPiece(p_start: TCvPoint2D64f; p_end: TCvPoint2D64f; a: pdouble; b: pdouble; c: pdouble; result: PInteger); cdecl; external legacy_lib; +procedure icvComputeeInfiniteProject1(rotMatr: pdouble; camMatr1: pdouble; camMatr2: pdouble; point1: TCvPoint2D32f; point2: pCvPoint2D32f); cdecl; external legacy_lib; +procedure icvComputeeInfiniteProject2(rotMatr: pdouble; camMatr1: pdouble; camMatr2: pdouble; point1: pCvPoint2D32f; point2: TCvPoint2D32f); cdecl; external legacy_lib; +procedure icvGetCrossDirectDirect(direct1: pdouble; direct2: pdouble; cross: pCvPoint2D64f; result: PInteger); cdecl; external legacy_lib; +procedure icvGetCrossPieceDirect(p_start: TCvPoint2D64f; p_end: TCvPoint2D64f; a: double; b: double; c: double; cross: pCvPoint2D64f; result: PInteger); cdecl; external legacy_lib; +procedure icvGetCrossPiecePiece(p1_start: TCvPoint2D64f; p1_end: TCvPoint2D64f; p2_start: TCvPoint2D64f; p2_end: TCvPoint2D64f; cross: pCvPoint2D64f; + result: PInteger); cdecl; external legacy_lib; +procedure icvGetPieceLength(point1: TCvPoint2D64f; point2: TCvPoint2D64f; dist: pdouble); cdecl; external legacy_lib; +procedure icvGetCrossRectDirect(imageSize: TCvSize; a: double; b: double; c: double; start: pCvPoint2D64f; end_: pCvPoint2D64f; result: PInteger); cdecl; external legacy_lib; +procedure icvProjectPointToImage(point: TCvPoint3D64f; camMatr: pdouble; rotMatr: pdouble; transVect: pdouble; projPoint: pCvPoint2D64f); cdecl; external legacy_lib; +procedure icvGetQuadsTransform(imageSize: TCvSize; camMatr1: pdouble; rotMatr1: pdouble; transVect1: pdouble; camMatr2: pdouble; rotMatr2: pdouble; + transVect2: pdouble; warpSize: pCvSize; quad1: TicvGetQuadsTransformQuad; quad2: TicvGetQuadsTransformQuad; fundMatr: pdouble; epipole1: pCvPoint3D64f; + epipole2: pCvPoint3D64f); cdecl; external legacy_lib; +procedure icvGetQuadsTransformStruct(stereoCamera: pCvStereoCamera); cdecl; external legacy_lib; +procedure icvComputeStereoParamsForCameras(stereoCamera: pCvStereoCamera); cdecl; external legacy_lib; +procedure icvGetCutPiece(areaLineCoef1: pdouble; areaLineCoef2: pdouble; epipole: TCvPoint2D64f; imageSize: TCvSize; point11: pCvPoint2D64f; + point12: pCvPoint2D64f; point21: pCvPoint2D64f; point22: pCvPoint2D64f; result: PInteger); cdecl; external legacy_lib; +procedure icvGetMiddleAnglePoint(basePoint: TCvPoint2D64f; point1: TCvPoint2D64f; point2: TCvPoint2D64f; midPoint: pCvPoint2D64f); cdecl; external legacy_lib; +procedure icvGetNormalDirect(direct: pdouble; point: TCvPoint2D64f; normDirect: pdouble); cdecl; external legacy_lib; +function icvGetVect(basePoint: TCvPoint2D64f; point1: TCvPoint2D64f; point2: TCvPoint2D64f): double; cdecl; external legacy_lib; +procedure icvProjectPointToDirect(point: TCvPoint2D64f; lineCoeff: pdouble; projectPoint: pCvPoint2D64f); cdecl; external legacy_lib; +procedure icvGetDistanceFromPointToDirect(point: TCvPoint2D64f; lineCoef: pdouble; dist: pdouble); cdecl; external legacy_lib; +function icvCreateIsometricImage(src: pIplImage; dst: pIplImage; desired_depth: Integer; desired_num_channels: Integer): pIplImage; cdecl; external legacy_lib; +procedure cvDeInterlace(const frame: pCvArr; fieldEven: pCvArr; fieldOdd: pCvArr); cdecl; external legacy_lib; +function cvCreateContourTree(const contour: pCvSeq; storage: pCvMemStorage; threshold: double): pCvContourTree; cdecl; external legacy_lib; +function cvContourFromContourTree(const tree: pCvContourTree; storage: pCvMemStorage; criteria: TCvTermCriteria): pCvSeq; cdecl; external legacy_lib; +function cvMatchContourTrees(const tree1: pCvContourTree; const tree2: pCvContourTree; method: Integer; threshold: double): double; cdecl; external legacy_lib; +function cvCalcContoursCorrespondence(const contour1: pCvSeq; const contour2: pCvSeq; storage: pCvMemStorage): pCvSeq; cdecl; external legacy_lib; +function cvMorphContours(const contour1: pCvSeq; const contour2: pCvSeq; corr: pCvSeq; alpha: double; storage: pCvMemStorage): pCvSeq; cdecl; external legacy_lib; +function cvCreateGLCM(const srcImage: pIplImage; stepMagnitude: Integer; const stepDirections: PInteger = nil; numStepDirections: Integer = 0; + optimizationType: Integer = CV_GLCM_OPTIMIZATION_NONE): pCvGLCM; cdecl; external legacy_lib; +procedure cvReleaseGLCM(var GLCM: pCvGLCM; flag: Integer = CV_GLCM_ALL); cdecl; external legacy_lib; +procedure cvCreateGLCMDescriptors(destGLCM: pCvGLCM; descriptorOptimizationType: Integer = CV_GLCMDESC_OPTIMIZATION_ALLOWDOUBLENEST); cdecl; external legacy_lib; +function cvGetGLCMDescriptor(GLCM: pCvGLCM; step: Integer; descriptor: Integer): double; cdecl; external legacy_lib; +procedure cvGetGLCMDescriptorStatistics(GLCM: pCvGLCM; descriptor: Integer; average: pdouble; standardDeviation: pdouble); cdecl; external legacy_lib; +function cvCreateGLCMImage(GLCM: pCvGLCM; step: Integer): pIplImage; cdecl; external legacy_lib; +function cvInitFaceTracker(pFaceTracking: pCvFaceTracker; const imgGray: pIplImage; pRects: pCvRect; nRects: Integer): pCvFaceTracker; cdecl; external legacy_lib; +function cvTrackFace(pFaceTracker: pCvFaceTracker; imgGray: pIplImage; pRects: pCvRect; nRects: Integer; ptRotate: pCvPoint; dbAngleRotate: pdouble) + : Integer; cdecl; external legacy_lib; +procedure cvReleaseFaceTracker(var ppFaceTracker: pCvFaceTracker); cdecl; external legacy_lib; +function cvFindFace(image: pIplImage; storage: pCvMemStorage): pCvSeq; cdecl; external legacy_lib; +function cvPostBoostingFindFace(image: pIplImage; storage: pCvMemStorage): pCvSeq; cdecl; external legacy_lib; +function cv3dTrackerCalibrateCameras(num_cameras: Integer; camera_intrinsics: pCv3dTrackerCameraIntrinsics; etalon_size: TCvSize; square_size: Single; + var samples: pIplImage; camera_info: pCv3dTrackerCameraInfo): TCvBool; cdecl; external legacy_lib; +function cv3dTrackerLocateObjects(num_cameras: Integer; num_objects: Integer; camera_info: pCv3dTrackerCameraInfo; tracking_info: pCv3dTracker2dTrackedObject; + tracked_objects: pCv3dTrackerTrackedObject): Integer; cdecl; external legacy_lib; +function cvVoronoiDiagramFromContour(ContourSeq: pCvSeq; var VoronoiDiagram: pCvVoronoiDiagram2D; VoronoiStorage: pCvMemStorage; + contour_type: TCvLeeParameters = CV_LEE_INT; contour_orientation: Integer = -1; attempt_number: Integer = 10): Integer; cdecl; external legacy_lib; +function cvVoronoiDiagramFromImage(pImage: pIplImage; var ContourSeq: pCvSeq; var VoronoiDiagram: pCvVoronoiDiagram2D; VoronoiStorage: pCvMemStorage; + regularization_method: TCvLeeParameters = CV_LEE_NON; approx_precision: float = -1 { CV_LEE_AUTO } ): Integer; cdecl; external legacy_lib; +procedure cvReleaseVoronoiStorage(VoronoiDiagram: pCvVoronoiDiagram2D; var pVoronoiStorage: pCvMemStorage); cdecl; external legacy_lib; +function cvLinearContorModelFromVoronoiDiagram(VoronoiDiagram: pCvVoronoiDiagram2D; maxWidth: float): pCvGraph; cdecl; external legacy_lib; +function cvReleaseLinearContorModelStorage(var Graph: pCvGraph): Integer; cdecl; external legacy_lib; +procedure cvInitPerspectiveTransform(size: TCvSize; const vertex: TcvInitPerspectiveTransformVertex; matrix: TcvInitPerspectiveTransformMatrix; + rectMap: pCvArr); cdecl; external legacy_lib; +procedure cvMakeScanlines(const matrix: pCvMatrix3; img_size: TCvSize; scanlines1: PInteger; scanlines2: PInteger; lengths1: PInteger; lengths2: PInteger; + line_count: PInteger); cdecl; external legacy_lib; +procedure cvPreWarpImage(line_count: Integer; img: pIplImage; dst: puchar; dst_nums: PInteger; scanlines: PInteger); cdecl; external legacy_lib; +procedure cvFindRuns(line_count: Integer; prewarp1: puchar; prewarp2: puchar; line_lengths1: PInteger; line_lengths2: PInteger; runs1: PInteger; + runs2: PInteger; num_runs1: PInteger; num_runs2: PInteger); cdecl; external legacy_lib; +procedure cvDynamicCorrespondMulti(line_count: Integer; first: PInteger; first_runs: PInteger; second: PInteger; second_runs: PInteger; first_corr: PInteger; + second_corr: PInteger); cdecl; external legacy_lib; +procedure cvMakeAlphaScanlines(scanlines1: PInteger; scanlines2: PInteger; scanlinesA: PInteger; lengths: PInteger; line_count: Integer; alpha: float); cdecl; external legacy_lib; +procedure cvMorphEpilinesMulti(line_count: Integer; first_pix: puchar; first_num: PInteger; second_pix: puchar; second_num: PInteger; dst_pix: puchar; + dst_num: PInteger; alpha: float; first: PInteger; first_runs: PInteger; second: PInteger; second_runs: PInteger; first_corr: PInteger; + second_corr: PInteger); cdecl; external legacy_lib; +procedure cvPostWarpImage(line_count: Integer; src: puchar; src_nums: PInteger; img: pIplImage; scanlines: PInteger); cdecl; external legacy_lib; +procedure cvDeleteMoire(img: pIplImage); cdecl; external legacy_lib; +function cvCreateConDensation(dynam_params: Integer; measure_params: Integer; sample_count: Integer): pCvConDensation; cdecl; external legacy_lib; +procedure cvReleaseConDensation(var condens: pCvConDensation); cdecl; external legacy_lib; +procedure cvConDensUpdateByTime(condens: pCvConDensation); cdecl; external legacy_lib; +procedure cvConDensInitSampleSet(condens: pCvConDensation; lower_bound: pCvMat; upper_bound: pCvMat); cdecl; external legacy_lib; +procedure cvClearSubdivVoronoi2D(subdiv: pCvSubdiv2D); cdecl; external legacy_lib; +function cvFindNearestPoint2D(subdiv: pCvSubdiv2D; pt: TCvPoint2D32f): pCvSubdiv2DPoint; cdecl; external legacy_lib; +procedure icvDrawMosaic(subdiv: pCvSubdiv2D; src: pIplImage; dst: pIplImage); cdecl; external legacy_lib; +function icvSubdiv2DCheck(subdiv: pCvSubdiv2D): Integer; cdecl; external legacy_lib; +function cvCreateKDTree(desc: pCvMat): pCvFeatureTree; cdecl; external legacy_lib; +function cvCreateSpillTree(const raw_data: pCvMat; const naive: Integer = 50; const rho: double = 0.7; const tau: double = 0.1): pCvFeatureTree; cdecl; external legacy_lib; +procedure cvReleaseFeatureTree(tr: pCvFeatureTree); cdecl; external legacy_lib; +procedure cvFindFeatures(tr: pCvFeatureTree; const query_points: pCvMat; indices: pCvMat; dist: pCvMat; K: Integer; emax: Integer = 20); cdecl; external legacy_lib; +function cvFindFeaturesBoxed(tr: pCvFeatureTree; bounds_min: pCvMat; bounds_max: pCvMat; out_indices: pCvMat): Integer; cdecl; external legacy_lib; +function cvCreateLSH(ops: pCvLSHOperations; d: Integer; L: Integer { =10 }; K: Integer { =10 }; type_: Integer { =CV_64FC1 }; r: double { =4 }; + seed: int64 { =-1 } ): pCvLSH; cdecl; external legacy_lib; +function cvCreateMemoryLSH(d: Integer; n: Integer; L: Integer { =10 }; K: Integer { =10 }; type_: Integer { =CV_64FC1 }; r: double { =4 }; seed: int64 { =-1 } ) + : pCvLSH; cdecl; external legacy_lib; +procedure cvReleaseLSH(lsh: pCvLSH); cdecl; external legacy_lib; +function LSHSize(lsh: pCvLSH): uint; cdecl; external legacy_lib; +procedure cvLSHAdd(lsh: pCvLSH; const data: pCvMat; indices: pCvMat = nil); cdecl; external legacy_lib; +procedure cvLSHRemove(lsh: pCvLSH; const indices: pCvMat); cdecl; external legacy_lib; +procedure cvLSHQuery(lsh: pCvLSH; const query_points: pCvMat; indices: pCvMat; dist: pCvMat; K: Integer; emax: Integer); cdecl; external legacy_lib; +procedure cvCalcOpticalFlowLK(const prev: pCvArr; const curr: pCvArr; win_size: TCvSize; velx: pCvArr; vely: pCvArr); cdecl; external legacy_lib; +procedure cvCalcOpticalFlowBM(const prev: pCvArr; const curr: pCvArr; block_size: TCvSize; shift_size: TCvSize; max_range: TCvSize; use_previous: Integer; + velx: pCvArr; vely: pCvArr); cdecl; external legacy_lib; +procedure cvCalcOpticalFlowHS(const prev: pCvArr; const curr: pCvArr; use_previous: Integer; velx: pCvArr; vely: pCvArr; lambda: double; + criteria: TCvTermCriteria); cdecl; external legacy_lib; +procedure cvRefineForegroundMaskBySegm(segments: pCvSeq; bg_model: pCvBGStatModel); cdecl; external legacy_lib; +function cvChangeDetection(prev_frame: pIplImage; curr_frame: pIplImage; change_mask: pIplImage): Integer; cdecl; external legacy_lib; end. diff --git a/source/ocv.lib.pas b/source/ocv.lib.pas index be78237..16860a9 100644 --- a/source/ocv.lib.pas +++ b/source/ocv.lib.pas @@ -47,12 +47,14 @@ const CV_VERSION_MAJOR = '4'; CV_VERSION_MINOR = '13'; CV_VERSION_REVISION = '3'; -{$ELSEIF DEFINED(DelphiOCVVersion_30)} +{$ELSE} +{$IFDEF DelphiOCVVersion_30} CV_VERSION_EPOCH = '3'; CV_VERSION_MAJOR = '0'; CV_VERSION_MINOR = '0'; CV_VERSION_REVISION = '0'; -{$IFEND} +{$ENDIF} +{$ENDIF} CV_VERSION = CV_VERSION_EPOCH + '.' + CV_VERSION_MAJOR + '.' + CV_VERSION_MINOR + '.' + CV_VERSION_REVISION; // * old style version constants*/ @@ -74,27 +76,27 @@ const core_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} + {$IF DEFINED(DelphiOCVVersion_29)} 'core' + -{$ELSEIF DEFINED( DelphiOCVVersion_30)} + {$ELSEIF DEFINED(DelphiOCVVersion_30)} 'world' + -{$IFEND} + {$ENDIF} CV_VERSION_DLL {$IFDEF DEBUG} + 'd'{$ENDIF} + '.dll'; {$ELSE} -{$IFDEF MACOS} + {$IFDEF MACOS} 'opencv_core.dylib'; -{$ELSE} -{$IFDEF ANDROID} + {$ELSE} + {$IFDEF ANDROID} 'libopencv_core.so'; -{$ELSE} + {$ELSE} 'libopencv_core.so'; -{$ENDIF} -{$ENDIF} + {$ENDIF} + {$ENDIF} {$ENDIF} // ------------------------------- highgui_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'highgui' + {$ELSEIF DEFINED( DelphiOCVVersion_30)} 'world' + @@ -114,7 +116,7 @@ highgui_lib = {$IFDEF MSWINDOWS} // ------------------------------- features2d_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'features2d' + {$ELSEIF DEFINED( DelphiOCVVersion_30)} 'world' + @@ -134,7 +136,7 @@ features2d_lib = {$IFDEF MSWINDOWS} // ------------------------------- imgproc_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'imgproc' + {$ELSEIF DEFINED( DelphiOCVVersion_30)} 'world' + @@ -154,7 +156,7 @@ imgproc_lib = {$IFDEF MSWINDOWS} // ------------------------------- objdetect_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'objdetect' + {$ELSEIF DEFINED( DelphiOCVVersion_30)} 'world' + @@ -174,9 +176,9 @@ objdetect_lib = {$IFDEF MSWINDOWS} // ------------------------------- legacy_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'legacy' + -{$ELSEIF DEFINED( DelphiOCVVersion_30)} +{$ELSEIF DEFINED(DelphiOCVVersion_30)} 'world' + {$IFEND} CV_VERSION_DLL {$IFDEF DEBUG} + 'd'{$ENDIF} + '.dll'; @@ -194,7 +196,7 @@ legacy_lib = {$IFDEF MSWINDOWS} // ------------------------------- calib3d_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'calib3d' + {$ELSEIF DEFINED( DelphiOCVVersion_30)} 'world' + @@ -214,9 +216,9 @@ calib3d_lib = {$IFDEF MSWINDOWS} // ------------------------------- tracking_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'video' + -{$ELSEIF DEFINED( DelphiOCVVersion_30)} +{$ELSEIF DEFINED(DelphiOCVVersion_30)} 'world' + {$IFEND} CV_VERSION_DLL {$IFDEF DEBUG} + 'd'{$ENDIF} + '.dll'; @@ -234,7 +236,7 @@ tracking_lib = {$IFDEF MSWINDOWS} // ------------------------------- nonfree_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'nonfree' + {$ELSEIF DEFINED( DelphiOCVVersion_30)} 'world' + @@ -268,7 +270,7 @@ opencv_classes_lib = {$IFDEF MSWINDOWS} // ------------------------------- opencv_photo_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'photo' + {$ELSEIF DEFINED( DelphiOCVVersion_30)} 'world' + @@ -288,7 +290,7 @@ opencv_photo_lib = {$IFDEF MSWINDOWS} // ------------------------------- opencv_contrib_lib = {$IFDEF MSWINDOWS} CV_DLL_DIR + 'opencv_' + -{$IFDEF DelphiOCVVersion_29} +{$IF DEFINED(DelphiOCVVersion_29)} 'contrib' + {$ELSEIF DEFINED( DelphiOCVVersion_30)} 'world' + diff --git a/source/ocv.lock.pas b/source/ocv.lock.pas index 22e14a3..8163e33 100644 --- a/source/ocv.lock.pas +++ b/source/ocv.lock.pas @@ -56,9 +56,9 @@ unit ocv.lock; interface Uses - Winapi.Windows + Windows {$IF DEFINED(USE_CRITICALSECTION) OR DEFINED(USE_SIMLOCK)} - , System.SyncObjs + , SyncObjs {$IFEND} ; @@ -114,13 +114,13 @@ type SRWLOCK = Pointer; {$WARNINGS OFF} -procedure AcquireSRWLockShared(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'AcquireSRWLockShared' delayed; -procedure ReleaseSRWLockShared(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'ReleaseSRWLockShared' delayed; -procedure AcquireSRWLockExclusive(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'AcquireSRWLockExclusive' delayed; -procedure ReleaseSRWLockExclusive(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'ReleaseSRWLockExclusive' delayed; -procedure InitializeSRWLock(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'InitializeSRWLock' delayed; -function TryAcquireSRWLockExclusive(Var P: SRWLOCK): Boolean; stdcall; external 'kernel32.dll' name 'TryAcquireSRWLockExclusive' delayed; -function TryAcquireSRWLockShared(Var P: SRWLOCK): Boolean; stdcall; external 'kernel32.dll' name 'TryAcquireSRWLockShared' delayed; +procedure AcquireSRWLockShared(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'AcquireSRWLockShared'{$IFNDEF FPC} delayed{$ENDIF}; +procedure ReleaseSRWLockShared(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'ReleaseSRWLockShared' {$IFNDEF FPC} delayed{$ENDIF}; +procedure AcquireSRWLockExclusive(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'AcquireSRWLockExclusive' {$IFNDEF FPC} delayed{$ENDIF}; +procedure ReleaseSRWLockExclusive(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'ReleaseSRWLockExclusive' {$IFNDEF FPC} delayed{$ENDIF}; +procedure InitializeSRWLock(var P: SRWLOCK); stdcall; external 'kernel32.dll' name 'InitializeSRWLock' {$IFNDEF FPC} delayed{$ENDIF}; +function TryAcquireSRWLockExclusive(Var P: SRWLOCK): Boolean; stdcall; external 'kernel32.dll' name 'TryAcquireSRWLockExclusive' {$IFNDEF FPC} delayed{$ENDIF}; +function TryAcquireSRWLockShared(Var P: SRWLOCK): Boolean; stdcall; external 'kernel32.dll' name 'TryAcquireSRWLockShared' {$IFNDEF FPC} delayed{$ENDIF}; {$WARNINGS ON} { TSRWLock } diff --git a/source/ocv.nonfree.pas b/source/ocv.nonfree.pas index 6b100a7..686f3fa 100644 --- a/source/ocv.nonfree.pas +++ b/source/ocv.nonfree.pas @@ -61,7 +61,7 @@ uses ocv.lib; {$IFNDEF DelphiOCVVersion_30} //function initModule_nonfree; external nonfree_lib index 895; -function initModule_nonfree; external nonfree_lib name '?initModule_nonfree@cv@@YA_NXZ'; +function initModule_nonfree(): ByteBool; cdecl; external nonfree_lib name '?initModule_nonfree@cv@@YA_NXZ'; initialization diff --git a/source/ocv.objdetect_c.pas b/source/ocv.objdetect_c.pas index cee589c..6cc1b1e 100644 --- a/source/ocv.objdetect_c.pas +++ b/source/ocv.objdetect_c.pas @@ -440,14 +440,18 @@ begin end; {$ELSE} -function cvLatentSvmDetectObjects; external objdetect_lib; -function cvLoadLatentSvmDetector; external objdetect_lib; -procedure cvReleaseLatentSvmDetector; external objdetect_lib; -function cvHaarDetectObjects; external objdetect_lib; -function cvLoadHaarClassifierCascade; external objdetect_lib; -procedure cvReleaseHaarClassifierCascade; external objdetect_lib; -procedure cvSetImagesForHaarClassifierCascade; external objdetect_lib; -function cvRunHaarClassifierCascade; external objdetect_lib; +function cvLatentSvmDetectObjects(image: pIplImage; detector: pCvLatentSvmDetector; storage: pCvMemStorage; overlap_threshold: single = 0.5; + numThreads: Integer = -1): pCvSeq; cdecl; external objdetect_lib; +function cvLoadLatentSvmDetector(const filename: pCVChar): pCvLatentSvmDetector; cdecl; external objdetect_lib; +procedure cvReleaseLatentSvmDetector(Var detector: pCvLatentSvmDetector); cdecl; external objdetect_lib; +function cvHaarDetectObjects(const image: pCvArr; cascade: pCvHaarClassifierCascade; storage: pCvMemStorage; scale_factor: Double { 1.1 }; + min_neighbors: Integer { 3 }; flags: Integer { 0 }; min_size: TCvSize { CV_DEFAULT(cvSize(0,0)) }; max_size: TCvSize { CV_DEFAULT(cvSize(0,0)) } ) + : pCvSeq; cdecl; external objdetect_lib; +function cvLoadHaarClassifierCascade(const directory: PAnsiChar; orig_window_size: TCvSize): pCvHaarClassifierCascade; cdecl; external objdetect_lib; +procedure cvReleaseHaarClassifierCascade(Var cascade: pCvHaarClassifierCascade); cdecl; external objdetect_lib; +procedure cvSetImagesForHaarClassifierCascade(cascade: pCvHaarClassifierCascade; const sum: pCvArr; const sqsum: pCvArr; const tilted_sum: pCvArr; + scale: Double); cdecl; external objdetect_lib; +function cvRunHaarClassifierCascade(const cascade: pCvHaarClassifierCascade; pt: TCvPoint; start_stage: Integer = 0): Integer; cdecl; external objdetect_lib; {$ENDIF} end. diff --git a/source/ocv.photo_c.pas b/source/ocv.photo_c.pas index c29bf09..ff83c3f 100644 --- a/source/ocv.photo_c.pas +++ b/source/ocv.photo_c.pas @@ -103,7 +103,7 @@ initialization Init_opencv_photo_lib; {$ELSE} -procedure cvInpaint; external opencv_photo_lib; +procedure cvInpaint(const src: pCvArr; const inpaint_mask: pCvArr; dst: pCvArr; inpaintRange: double; flags: Integer); cdecl; external opencv_photo_lib; {$ENDIF} end. diff --git a/source/ocv.tracking_c.pas b/source/ocv.tracking_c.pas index 1005a4c..3084222 100644 --- a/source/ocv.tracking_c.pas +++ b/source/ocv.tracking_c.pas @@ -60,9 +60,9 @@ uses ocv.core.types_c, ocv.imgproc.types_c; // ************************************ optical flow *************************************** const - CV_LKFLOW_PYR_A_READY = 1; - CV_LKFLOW_PYR_B_READY = 2; - CV_LKFLOW_INITIAL_GUESSES = 4; + CV_LKFLOW_PYR_A_READY = 1; + CV_LKFLOW_PYR_B_READY = 2; + CV_LKFLOW_INITIAL_GUESSES = 4; CV_LKFLOW_GET_MIN_EIGENVALS = 8; (* @@ -89,16 +89,16 @@ const Type TcvCalcOpticalFlowPyrLK = procedure(const prev: pIplImage; const curr: pIplImage; prev_pyr: pIplImage; curr_pyr: pIplImage; - const prev_features: pCvPoint2D32f; curr_features: pCvPoint2D32f; count: Integer; win_size: TCvSize; level: Integer; status: pCVChar; - track_error: PSingle; criteria: TCvTermCriteria; flags: Integer); cdecl; + const prev_features: pCvPoint2D32f; curr_features: pCvPoint2D32f; count: Integer; win_size: TCvSize; level: Integer; status: pCVChar; track_error: PSingle; + criteria: TCvTermCriteria; flags: Integer); cdecl; Var cvCalcOpticalFlowPyrLK: TcvCalcOpticalFlowPyrLK; {$ELSE} {$EXTERNALSYM cvCalcOpticalFlowPyrLK} -procedure cvCalcOpticalFlowPyrLK(const prev: pIplImage; const curr: pIplImage; prev_pyr: pIplImage; curr_pyr: pIplImage; - const prev_features: pCvPoint2D32f; curr_features: pCvPoint2D32f; count: Integer; win_size: TCvSize; level: Integer; status: pCVChar; - track_error: PSingle; criteria: TCvTermCriteria; flags: Integer); cdecl; +procedure cvCalcOpticalFlowPyrLK(const prev: pIplImage; const curr: pIplImage; prev_pyr: pIplImage; curr_pyr: pIplImage; const prev_features: pCvPoint2D32f; + curr_features: pCvPoint2D32f; count: Integer; win_size: TCvSize; level: Integer; status: pCVChar; track_error: PSingle; criteria: TCvTermCriteria; + flags: Integer); cdecl; {$ENDIF} (* Modification of a previous sparse optical flow algorithm to calculate affine flow @@ -116,8 +116,8 @@ procedure cvCalcOpticalFlowPyrLK(const prev: pIplImage; const curr: pIplImage; p Type TcvCalcAffineFlowPyrLK = procedure(const prev: pCvArr; const curr: pCvArr; prev_pyr: pCvArr; curr_pyr: pCvArr; const prev_features: pCvPoint2D32f; - var curr_features: TCvPoint2D32f; var matrices: Single; count: Integer; win_size: TCvSize; level: Integer; status: pCVChar; - var track_error: Single; criteria: TCvTermCriteria; flags: Integer); cdecl; + var curr_features: TCvPoint2D32f; var matrices: Single; count: Integer; win_size: TCvSize; level: Integer; status: pCVChar; var track_error: Single; + criteria: TCvTermCriteria; flags: Integer); cdecl; Var cvCalcAffineFlowPyrLK: TcvCalcAffineFlowPyrLK; @@ -205,15 +205,13 @@ procedure cvUpdateMotionHistory(const silhouette: pCvArr; mhi: pCvArr; timestamp {$IFDEF SAFELOADLIB} Type - TcvCalcMotionGradient = procedure(const mhi: pCvArr; mask: pCvArr; orientation: pCvArr; delta1: double; delta2: double; - aperture_size: Integer = 3); cdecl; + TcvCalcMotionGradient = procedure(const mhi: pCvArr; mask: pCvArr; orientation: pCvArr; delta1: double; delta2: double; aperture_size: Integer = 3); cdecl; var cvCalcMotionGradient: TcvCalcMotionGradient; {$ELSE} {$EXTERNALSYM cvCalcMotionGradient} -procedure cvCalcMotionGradient(const mhi: pCvArr; mask: pCvArr; orientation: pCvArr; delta1: double; delta2: double; - aperture_size: Integer = 3); cdecl; +procedure cvCalcMotionGradient(const mhi: pCvArr; mask: pCvArr; orientation: pCvArr; delta1: double; delta2: double; aperture_size: Integer = 3); cdecl; {$ENDIF} (* Calculates average motion direction within a selected motion region (region can be selected by setting ROIs and/or by composing a valid gradient mask @@ -226,15 +224,13 @@ procedure cvCalcMotionGradient(const mhi: pCvArr; mask: pCvArr; orientation: pCv {$IFDEF SAFELOADLIB} type - TcvCalcGlobalOrientation = function(const orientation: pCvArr; const mask: pCvArr; const mhi: pCvArr; timestamp: double; duration: double) - : double; cdecl; + TcvCalcGlobalOrientation = function(const orientation: pCvArr; const mask: pCvArr; const mhi: pCvArr; timestamp: double; duration: double): double; cdecl; var cvCalcGlobalOrientation: TcvCalcGlobalOrientation; {$ELSE} {$EXTERNALSYM cvCalcGlobalOrientation} -function cvCalcGlobalOrientation(const orientation: pCvArr; const mask: pCvArr; const mhi: pCvArr; timestamp: double; duration: double) - : double; cdecl; +function cvCalcGlobalOrientation(const orientation: pCvArr; const mask: pCvArr; const mhi: pCvArr; timestamp: double; duration: double): double; cdecl; {$ENDIF} (* Splits a motion history image into a few parts corresponding to separate independent motions (e.g. left hand, right hand) @@ -269,15 +265,13 @@ function cvSegmentMotion(const mhi: pCvArr; seg_mask: pCvArr; storage: pCvMemSto {$IFDEF SAFELOADLIB} type - TcvCamShift = function(const prob_image: pIplImage; window: TCvRect; criteria: TCvTermCriteria; comp: pCvConnectedComp; box: pCvBox2D = nil) - : Integer; cdecl; + TcvCamShift = function(const prob_image: pIplImage; window: TCvRect; criteria: TCvTermCriteria; comp: pCvConnectedComp; box: pCvBox2D = nil): Integer; cdecl; var cvCamShift: TcvCamShift; {$ELSE} {$EXTERNALSYM cvCamShift} -function cvCamShift(const prob_image: pIplImage; window: TCvRect; criteria: TCvTermCriteria; comp: pCvConnectedComp; box: pCvBox2D = nil) - : Integer; cdecl; +function cvCamShift(const prob_image: pIplImage; window: TCvRect; criteria: TCvTermCriteria; comp: pCvConnectedComp; box: pCvBox2D = nil): Integer; cdecl; {$ENDIF} (* Implements MeanShift algorithm - determines object position from the object histogram back project @@ -315,17 +309,17 @@ Type (* backward compatibility fields *) // {$IFDEF 1} - PosterState: PSingle; (* =state_pre->data.fl *) - PriorState: PSingle; (* =state_post->data.fl *) - DynamMatr: PSingle; (* =transition_matrix->data.fl *) - MeasurementMatr: PSingle; (* =measurement_matrix->data.fl *) - MNCovariance: PSingle; (* =measurement_noise_cov->data.fl *) - PNCovariance: PSingle; (* =process_noise_cov->data.fl *) - KalmGainMatr: PSingle; (* =gain->data.fl *) - PriorErrorCovariance: PSingle; (* =error_cov_pre->data.fl *) + PosterState: PSingle; (* =state_pre->data.fl *) + PriorState: PSingle; (* =state_post->data.fl *) + DynamMatr: PSingle; (* =transition_matrix->data.fl *) + MeasurementMatr: PSingle; (* =measurement_matrix->data.fl *) + MNCovariance: PSingle; (* =measurement_noise_cov->data.fl *) + PNCovariance: PSingle; (* =process_noise_cov->data.fl *) + KalmGainMatr: PSingle; (* =gain->data.fl *) + PriorErrorCovariance: PSingle; (* =error_cov_pre->data.fl *) PosterErrorCovariance: PSingle; (* =error_cov_post->data.fl *) - _Temp1: PSingle; (* temp1->data.fl *) - _Temp2: PSingle; (* temp2->data.fl *) + _Temp1: PSingle; (* temp1->data.fl *) + _Temp2: PSingle; (* temp2->data.fl *) // {$ENDIF} state_pre: pCvMat; (* predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k) *) @@ -334,8 +328,8 @@ Type transition_matrix: pCvMat; (* state transition matrix (A) *) control_matrix: pCvMat; (* control matrix (B) (it is not used if there is no control) *) - measurement_matrix: pCvMat; (* measurement matrix (H) *) - process_noise_cov: pCvMat; (* process noise covariance matrix (Q) *) + measurement_matrix: pCvMat; (* measurement matrix (H) *) + process_noise_cov: pCvMat; (* process noise covariance matrix (Q) *) measurement_noise_cov: pCvMat; (* measurement noise covariance matrix (R) *) error_cov_pre: pCvMat; (* priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q) *) @@ -411,9 +405,9 @@ function cvKalmanCorrect(var kalman: TCvKalman; const measurement: pCvMat): pCvM Var {$EXTERNALSYM cvKalmanUpdateByTime} - cvKalmanUpdateByTime: TcvKalmanPredict {$IFNDEF SAFELOADLIB} = cvKalmanPredict {$ENDIF}; + cvKalmanUpdateByTime: TcvKalmanPredict;// {$IFNDEF SAFELOADLIB} = cvKalmanPredict {$ENDIF}; {$EXTERNALSYM cvKalmanUpdateByMeasurement} - cvKalmanUpdateByMeasurement: TcvKalmanCorrect{$IFNDEF SAFELOADLIB} = cvKalmanCorrect{$ENDIF}; + cvKalmanUpdateByMeasurement: TcvKalmanCorrect;//{$IFNDEF SAFELOADLIB} = cvKalmanCorrect{$ENDIF}; {$IF DEFINED(SAFELOADLIB) AND DEFINED(DEBUG)} procedure Init_opencv_Tracking_lib; @@ -448,30 +442,36 @@ begin cvReleaseKalman := ocvGetProcAddress('cvReleaseKalman', TrackingDLL); cvKalmanPredict := ocvGetProcAddress('cvKalmanPredict', TrackingDLL); cvKalmanCorrect := ocvGetProcAddress('cvKalmanCorrect', TrackingDLL); - cvKalmanUpdateByTime := cvKalmanPredict; - cvKalmanUpdateByMeasurement := cvKalmanCorrect; end; +{$ELSE} +function cvCamShift(const prob_image: pIplImage; window: TCvRect; criteria: TCvTermCriteria; comp: pCvConnectedComp; box: pCvBox2D = nil): Integer; cdecl; external tracking_lib; +procedure cvCalcOpticalFlowPyrLK(const prev: pIplImage; const curr: pIplImage; prev_pyr: pIplImage; curr_pyr: pIplImage; const prev_features: pCvPoint2D32f; + curr_features: pCvPoint2D32f; count: Integer; win_size: TCvSize; level: Integer; status: pCVChar; track_error: PSingle; criteria: TCvTermCriteria; + flags: Integer); cdecl; external tracking_lib; +procedure cvCalcOpticalFlowFarneback(const prev: pCvMat; const next: pCvMat; flow: pCvMat; pyr_scale: double; levels: Integer; winsize: Integer; + iterations: Integer; poly_n: Integer; poly_sigma: double; flags: Integer); cdecl; external tracking_lib; + +procedure cvUpdateMotionHistory(const silhouette: pCvArr; mhi: pCvArr; timestamp: double; duration: double); cdecl; external tracking_lib; +procedure cvCalcMotionGradient(const mhi: pCvArr; mask: pCvArr; orientation: pCvArr; delta1: double; delta2: double; aperture_size: Integer = 3); cdecl; external tracking_lib; +function cvSegmentMotion(const mhi: pCvArr; seg_mask: pCvArr; storage: pCvMemStorage; timestamp: double; seg_thresh: double): pCvSeq; cdecl; external tracking_lib; +function cvCalcGlobalOrientation(const orientation: pCvArr; const mask: pCvArr; const mhi: pCvArr; timestamp: double; duration: double): double; cdecl; external tracking_lib; +procedure cvCalcAffineFlowPyrLK(const prev: pCvArr; const curr: pCvArr; prev_pyr: pCvArr; curr_pyr: pCvArr; const prev_features: pCvPoint2D32f; + var curr_features: TCvPoint2D32f; var matrices: Single; count: Integer; win_size: TCvSize; level: Integer; status: pCVChar; var track_error: Single; + criteria: TCvTermCriteria; flags: Integer); cdecl; external tracking_lib; +function cvEstimateRigidTransform(const A: pCvArr; const B: pCvArr; var M: TCvMat; full_affine: Integer): Integer; cdecl; external tracking_lib; +function cvMeanShift(const prob_image: pCvArr; window: TCvRect; criteria: TCvTermCriteria; var comp: TCvConnectedComp): Integer; cdecl; external tracking_lib; +function cvCreateKalman(dynam_params: Integer; measure_params: Integer; control_params: Integer = 0): pCvKalman; cdecl; external tracking_lib; +function cvKalmanPredict(var kalman: TCvKalman; const control: pCvMat = nil): pCvMat; cdecl; external tracking_lib; +function cvKalmanCorrect(var kalman: TCvKalman; const measurement: pCvMat): pCvMat; cdecl; external tracking_lib; +procedure cvReleaseKalman(var kalman: pCvKalman); cdecl; external tracking_lib; +{$ENDIF} initialization -Init_opencv_Tracking_lib; - -{$ELSE} -function cvCamShift; external tracking_lib; -procedure cvCalcOpticalFlowPyrLK; external tracking_lib; -procedure cvCalcOpticalFlowFarneback; external tracking_lib; - -procedure cvUpdateMotionHistory; external tracking_lib; -procedure cvCalcMotionGradient; external tracking_lib; -function cvSegmentMotion; external tracking_lib; -function cvCalcGlobalOrientation; external tracking_lib; -procedure cvCalcAffineFlowPyrLK; external tracking_lib; -function cvEstimateRigidTransform; external tracking_lib; -function cvMeanShift; external tracking_lib; -function cvCreateKalman; external tracking_lib; -function cvKalmanPredict; external tracking_lib; -function cvKalmanCorrect; external tracking_lib; -procedure cvReleaseKalman; external tracking_lib; +{$IFDEF SAFELOADLIB} + Init_opencv_Tracking_lib; {$ENDIF} +cvKalmanUpdateByTime := @cvKalmanPredict; +cvKalmanUpdateByMeasurement := @cvKalmanCorrect; end. diff --git a/source/ocv.utils.pas b/source/ocv.utils.pas index eb8ce97..cfbf68e 100644 --- a/source/ocv.utils.pas +++ b/source/ocv.utils.pas @@ -103,10 +103,12 @@ implementation uses {$IFDEF HAS_UNITSCOPE} System.SysUtils, + System.Math, {$ELSE} SysUtils, + Math, {$ENDIF} - ocv.core_c, System.Math; + ocv.core_c; {$IFDEF DELPHIXE3_UP} { TStringAnsiHelper } @@ -310,25 +312,25 @@ BEGIN TRY // assert((iplImg.Depth = 8) and (iplImg.NChannels = 3), // 'IplImage2Bitmap: Not a 24 bit color iplImage!'); - bitmap.Height := iplImg.Height; - bitmap.Width := iplImg.Width; + bitmap.Height := iplImg^.Height; + bitmap.Width := iplImg^.Width; FOR j := 0 TO bitmap.Height - 1 DO BEGIN // origin BL = Bottom-Left - if (iplImg.Origin = IPL_ORIGIN_BL) then + if (iplImg^.Origin = IPL_ORIGIN_BL) then RowIn := bitmap.Scanline[bitmap.Height - 1 - j] else RowIn := bitmap.Scanline[j]; - offset := longint(iplImg.ImageData) + iplImg.WidthStep * j; + offset := longint(iplImg^.ImageData) + iplImg^.WidthStep * j; dataByte := PByteArray(offset); - if (iplImg.ChannelSeq = 'BGR') then + if (iplImg^.ChannelSeq = 'BGR') then begin { direct copy of the iplImage row bytes to bitmap row } - CopyMemory(RowIn, dataByte, iplImg.WidthStep); + CopyMemory(RowIn, dataByte, iplImg^.WidthStep); End - else if (iplImg.ChannelSeq = 'GRAY') then + else if (iplImg^.ChannelSeq = 'GRAY') then FOR i := 0 TO bitmap.Width - 1 DO begin RowIn[3 * i] := dataByte[i]; diff --git a/source/sdl2/SDL2.pas b/source/sdl2/SDL2.pas index c8285a5..160909c 100644 --- a/source/sdl2/SDL2.pas +++ b/source/sdl2/SDL2.pas @@ -23,10 +23,18 @@ interface uses - System.Classes - ,System.SysUtils + {$IFDEF FPC} + SysUtils,Classes + {$ELSE} + System.SysUtils,System.Classes + {$ENDIF} {$IFDEF MSWINDOWS} - ,Winapi.Windows; + , + {$IFDEF FPC} + Windows; + {$ELSE} + Winapi.Windows; + {$ENDIF} {$ELSE} {$IFDEF LINUX} ,X diff --git a/source/sdl2/SDL2Frame/SDL2_Frame.pas b/source/sdl2/SDL2Frame/SDL2_Frame.pas index 5987374..2664584 100644 --- a/source/sdl2/SDL2Frame/SDL2_Frame.pas +++ b/source/sdl2/SDL2Frame/SDL2_Frame.pas @@ -11,12 +11,21 @@ unit SDL2_Frame; interface uses - Winapi.Windows, - VCL.Dialogs, +{$IFDEF FPC} + Windows, + Dialogs, SysUtils, Classes, Controls, ExtCtrls, +{$ELSE} + Winapi.Windows, + System.SysUtils, + System.Classes, + VCL.Controls, + VCL.ExtCtrls, + VCL.Dialogs, +{$ENDIF} SDL2; type diff --git a/source/sdl2/SDL2_Net.pas b/source/sdl2/SDL2_Net.pas index 31b065f..afd243a 100644 --- a/source/sdl2/SDL2_Net.pas +++ b/source/sdl2/SDL2_Net.pas @@ -1,9 +1,9 @@ unit SDL2_Net; -{******************************************************************************* +{ ******************************************************************************* SDL2_Net.pas v1.0 29/07/2013 first version for DelphiXE - v1.1 27/08/2013 add MACOS compability - v1.2 31/05/2014 delete sdl2.inc + v1.1 27/08/2013 add MACOS compability + v1.2 31/05/2014 delete sdl2.inc Simple DirectMedia Layer Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> @@ -16,513 +16,483 @@ unit SDL2_Net; Dominqiue Louis <Dominique@SavageSoftware.com.au> -*******************************************************************************} - + ******************************************************************************* } interface uses {$IFDEF MSWINDOWS} +{$IFDEF FPC} + Windows, +{$ELSE} Winapi.Windows, +{$ENDIF} {$ENDIF} SDL2; const - {$IFDEF MSWINDOWS} - SDL_NetLibName = 'SDL2_net.dll'; - {$ENDIF} - - {$IFDEF ANDROID} - SDL_NetLibName = 'libSDL2_net.so'; - {$ENDIF} - - {$IFDEF MACOS} - {$IFDEF IOS} - SDL_NetLibName = 'libSDL2_net.a'; - {$ELSE} - SDL_NetLibName = 'SDL2_net'; -// SDL_NetLibName = '../Frameworks/SDL2_net.framework/Versions/A/SDL2_net'; - {$ENDIF} - {$ENDIF} - - {* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *} +{$IFDEF MSWINDOWS} + SDL_NetLibName = 'SDL2_net.dll'; +{$ENDIF} +{$IFDEF ANDROID} + SDL_NetLibName = 'libSDL2_net.so'; +{$ENDIF} +{$IFDEF MACOS} +{$IFDEF IOS} + SDL_NetLibName = 'libSDL2_net.a'; +{$ELSE} + SDL_NetLibName = 'SDL2_net'; + // SDL_NetLibName = '../Frameworks/SDL2_net.framework/Versions/A/SDL2_net'; +{$ENDIF} +{$ENDIF} + { * Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL * } SDL_NET_MAJOR_VERSION = 1; {$EXTERNALSYM SDL_NET_MAJOR_VERSION} SDL_NET_MINOR_VERSION = 2; {$EXTERNALSYM SDL_NET_MINOR_VERSION} SDL_NET_PATCHLEVEL = 7; {$EXTERNALSYM SDL_NET_PATCHLEVEL} - // SDL_Net.h constants - {* Resolve a host name and port to an IP address in network form. - If the function succeeds, it will return 0. - If the host couldn't be resolved, the host portion of the returned - address will be INADDR_NONE, and the function will return -1. - If 'host' is NULL, the resolved host will be set to INADDR_ANY. - *} + { * Resolve a host name and port to an IP address in network form. + If the function succeeds, it will return 0. + If the host couldn't be resolved, the host portion of the returned + address will be INADDR_NONE, and the function will return -1. + If 'host' is NULL, the resolved host will be set to INADDR_ANY. + * } INADDR_ANY = $00000000; {$EXTERNALSYM INADDR_ANY} - INADDR_NONE = $FFFFFFFF; {$EXTERNALSYM INADDR_NONE} - -{***********************************************************************} -{* UDP network API *} -{***********************************************************************} -{* The maximum channels on a a UDP socket *} + { *********************************************************************** } + { * UDP network API * } + { *********************************************************************** } + { * The maximum channels on a a UDP socket * } SDLNET_MAX_UDPCHANNELS = 32; {$EXTERNALSYM SDLNET_MAX_UDPCHANNELS} -{* The maximum addresses bound to a single UDP socket channel *} + { * The maximum addresses bound to a single UDP socket channel * } SDLNET_MAX_UDPADDRESSES = 4; {$EXTERNALSYM SDLNET_MAX_UDPADDRESSES} type // SDL_net.h types - {***********************************************************************} - {* IPv4 hostname resolution API *} - {***********************************************************************} + { *********************************************************************** } + { * IPv4 hostname resolution API * } + { *********************************************************************** } PIPAddress = ^TIPAddress; + TIPAddress = record - host : Uint32; // 32-bit IPv4 host address */ - port : Uint16; // 16-bit protocol port */ + host: Uint32; // 32-bit IPv4 host address */ + port: Uint16; // 16-bit protocol port */ end; - {***********************************************************************} - {* TCP network API *} - {***********************************************************************} + { *********************************************************************** } + { * TCP network API * } + { *********************************************************************** } PTCPSocket = ^TTCPSocket; + TTCPSocket = record - ready : integer; -//{$IFDEF MSWINDOWS} - channel : integer; -//{$ENDIF} - remoteAddress : TIPaddress; - localAddress : TIPaddress; - sflag : integer; + ready: integer; + // {$IFDEF MSWINDOWS} + channel: integer; + // {$ENDIF} + remoteAddress: TIPAddress; + localAddress: TIPAddress; + sflag: integer; end; - {***********************************************************************} - {* UDP network API *} - {***********************************************************************} + { *********************************************************************** } + { * UDP network API * } + { *********************************************************************** } PUDP_Channel = ^TUDP_Channel; + TUDP_Channel = record - numbound : integer; - address : array[ 0..SDLNET_MAX_UDPADDRESSES - 1 ] of TIPAddress; + numbound: integer; + address: array [0 .. SDLNET_MAX_UDPADDRESSES - 1] of TIPAddress; end; PUDPSocket = ^TUDPSocket; + TUDPSocket = record - ready : integer; -//{$IFDEF MSWINDOWS} - channel : integer; -//{$ENDIF} - address : TIPAddress; - binding : array[ 0..SDLNET_MAX_UDPCHANNELS - 1 ] of TUDP_Channel; + ready: integer; + // {$IFDEF MSWINDOWS} + channel: integer; + // {$ENDIF} + address: TIPAddress; + binding: array [0 .. SDLNET_MAX_UDPCHANNELS - 1] of TUDP_Channel; end; PUDPpacket = ^TUDPpacket; PPUDPpacket = ^PUDPpacket; + TUDPpacket = record - channel : integer; {* The src/dst channel of the packet *} - data : PUint8; {* The packet data *} - len : integer; {* The length of the packet data *} - maxlen : integer; {* The size of the data buffer *} - status : integer; {* packet status after sending *} - address : TIPAddress; {* The source/dest address of an incoming/outgoing packet *} + channel: integer; { * The src/dst channel of the packet * } + data: PUint8; { * The packet data * } + len: integer; { * The length of the packet data * } + maxlen: integer; { * The size of the data buffer * } + status: integer; { * packet status after sending * } + address: TIPAddress; { * The source/dest address of an incoming/outgoing packet * } end; - {***********************************************************************} - {* Hooks for checking sockets for available data *} - {***********************************************************************} + { *********************************************************************** } + { * Hooks for checking sockets for available data * } + { *********************************************************************** } PSDLNet_Socket = ^TSDLNet_Socket; + TSDLNet_Socket = record - ready : integer; -//{$IFDEF MSWINDOWS} - channel : integer; -//{$ENDIF} + ready: integer; + // {$IFDEF MSWINDOWS} + channel: integer; + // {$ENDIF} end; PSDLNet_SocketSet = ^TSDLNet_SocketSet; + TSDLNet_SocketSet = record - numsockets : integer; - maxsockets : integer; - sockets : PSDLNet_Socket; + numsockets: integer; + maxsockets: integer; + sockets: PSDLNet_Socket; end; - {* Any network socket can be safely cast to this socket type *} + { * Any network socket can be safely cast to this socket type * } PSDLNet_GenericSocket = ^TSDLNet_GenericSocket; + TSDLNet_GenericSocket = record - ready : integer; + ready: integer; end; -{ This macro can be used to fill a version structure with the compile-time - version of the SDL_net library. } -procedure SDL_NET_VERSION( var X : TSDL_version ); + { This macro can be used to fill a version structure with the compile-time + version of the SDL_net library. } +procedure SDL_NET_VERSION(var X: TSDL_version); -{* Initialize/Cleanup the network API - SDL must be initialized before calls to functions in this library, - because this library uses utility functions from the SDL library. -*} -function SDLNet_Init() : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Init' {$ENDIF} {$ENDIF}; +{ * Initialize/Cleanup the network API + SDL must be initialized before calls to functions in this library, + because this library uses utility functions from the SDL library. + * } +function SDLNet_Init(): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Init' {$ENDIF} {$ENDIF}; -procedure SDLNet_Quit(); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Quit' {$ENDIF} {$ENDIF}; +procedure SDLNet_Quit(); cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Quit' {$ENDIF} {$ENDIF}; - {* Resolve a host name and port to an IP address in network form. - If the function succeeds, it will return 0. - If the host couldn't be resolved, the host portion of the returned - address will be INADDR_NONE, and the function will return -1. - If 'host' is NULL, the resolved host will be set to INADDR_ANY. - *} -function SDLNet_ResolveHost( var address : TIPaddress; host : PChar; port : Uint16 ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_ResolveHost' {$ENDIF} {$ENDIF}; +{ * Resolve a host name and port to an IP address in network form. + If the function succeeds, it will return 0. + If the host couldn't be resolved, the host portion of the returned + address will be INADDR_NONE, and the function will return -1. + If 'host' is NULL, the resolved host will be set to INADDR_ANY. + * } +function SDLNet_ResolveHost(var address: TIPAddress; host: PChar; port: Uint16): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_ResolveHost' {$ENDIF} {$ENDIF}; -{* Resolve an ip address to a host name in canonical form. - If the ip couldn't be resolved, this function returns NULL, - otherwise a pointer to a static buffer containing the hostname - is returned. Note that this function is not thread-safe. -*} -function SDLNet_ResolveIP( var ip : TIPaddress ) : PChar; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_ResolveIP' {$ENDIF} {$ENDIF}; +{ * Resolve an ip address to a host name in canonical form. + If the ip couldn't be resolved, this function returns NULL, + otherwise a pointer to a static buffer containing the hostname + is returned. Note that this function is not thread-safe. + * } +function SDLNet_ResolveIP(var ip: TIPAddress): PChar; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_ResolveIP' {$ENDIF} {$ENDIF}; - {***********************************************************************} - {* TCP network API *} - {***********************************************************************} +{ *********************************************************************** } +{ * TCP network API * } +{ *********************************************************************** } -{* Open a TCP network socket - If ip.host is INADDR_NONE, this creates a local server socket on the - given port, otherwise a TCP connection to the remote host and port is - attempted. The address passed in should already be swapped to network - byte order (addresses returned from SDLNet_ResolveHost() are already - in the correct form). - The newly created socket is returned, or NULL if there was an error. -*} -function SDLNet_TCP_Open( var ip : TIPaddress ) : PTCPSocket; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Open' {$ENDIF} {$ENDIF}; +{ * Open a TCP network socket + If ip.host is INADDR_NONE, this creates a local server socket on the + given port, otherwise a TCP connection to the remote host and port is + attempted. The address passed in should already be swapped to network + byte order (addresses returned from SDLNet_ResolveHost() are already + in the correct form). + The newly created socket is returned, or NULL if there was an error. + * } +function SDLNet_TCP_Open(var ip: TIPAddress): PTCPSocket; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Open' {$ENDIF} {$ENDIF}; -{* Accept an incoming connection on the given server socket. - The newly created socket is returned, or NULL if there was an error. -*} -function SDLNet_TCP_Accept( server : PTCPsocket ) : PTCPSocket; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Accept' {$ENDIF} {$ENDIF}; +{ * Accept an incoming connection on the given server socket. + The newly created socket is returned, or NULL if there was an error. + * } +function SDLNet_TCP_Accept(server: PTCPSocket): PTCPSocket; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Accept' {$ENDIF} {$ENDIF}; -{* Get the IP address of the remote system associated with the socket. - If the socket is a server socket, this function returns NULL. -*} -function SDLNet_TCP_GetPeerAddress( sock : PTCPsocket ) : PIPAddress; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_GetPeerAddress' {$ENDIF} {$ENDIF}; +{ * Get the IP address of the remote system associated with the socket. + If the socket is a server socket, this function returns NULL. + * } +function SDLNet_TCP_GetPeerAddress(sock: PTCPSocket): PIPAddress; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_GetPeerAddress' +{$ENDIF} {$ENDIF}; -{* Send 'len' bytes of 'data' over the non-server socket 'sock' - This function returns the actual amount of data sent. If the return value - is less than the amount of data sent, then either the remote connection was - closed, or an unknown socket error occurred. -*} -function SDLNet_TCP_Send( sock : PTCPsocket; data : Pointer; len : integer ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Send' {$ENDIF} {$ENDIF}; +{ * Send 'len' bytes of 'data' over the non-server socket 'sock' + This function returns the actual amount of data sent. If the return value + is less than the amount of data sent, then either the remote connection was + closed, or an unknown socket error occurred. + * } +function SDLNet_TCP_Send(sock: PTCPSocket; data: Pointer; len: integer): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Send' {$ENDIF} {$ENDIF}; -{* Receive up to 'maxlen' bytes of data over the non-server socket 'sock', - and store them in the buffer pointed to by 'data'. - This function returns the actual amount of data received. If the return - value is less than or equal to zero, then either the remote connection was - closed, or an unknown socket error occurred. -*} -function SDLNet_TCP_Recv( sock : PTCPsocket; data : Pointer; maxlen : integer ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Recv' {$ENDIF} {$ENDIF}; +{ * Receive up to 'maxlen' bytes of data over the non-server socket 'sock', + and store them in the buffer pointed to by 'data'. + This function returns the actual amount of data received. If the return + value is less than or equal to zero, then either the remote connection was + closed, or an unknown socket error occurred. + * } +function SDLNet_TCP_Recv(sock: PTCPSocket; data: Pointer; maxlen: integer): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Recv' {$ENDIF} {$ENDIF}; -{* Close a TCP network socket *} -procedure SDLNet_TCP_Close( sock : PTCPsocket ); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Close' {$ENDIF} {$ENDIF}; +{ * Close a TCP network socket * } +procedure SDLNet_TCP_Close(sock: PTCPSocket); cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_TCP_Close' {$ENDIF} {$ENDIF}; +{ *********************************************************************** } +{ * UDP network API * } +{ *********************************************************************** } - {***********************************************************************} - {* UDP network API *} - {***********************************************************************} +{ * Allocate/resize/free a single UDP packet 'size' bytes long. + The new packet is returned, or NULL if the function ran out of memory. + * } +function SDLNet_AllocPacket(size: integer): PUDPpacket; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_AllocPacket' {$ENDIF} {$ENDIF}; - {* Allocate/resize/free a single UDP packet 'size' bytes long. - The new packet is returned, or NULL if the function ran out of memory. - *} -function SDLNet_AllocPacket( size : integer ) : PUDPpacket; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_AllocPacket' {$ENDIF} {$ENDIF}; +function SDLNet_ResizePacket(packet: PUDPpacket; newsize: integer): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_ResizePacket' {$ENDIF} {$ENDIF}; -function SDLNet_ResizePacket( packet : PUDPpacket; newsize : integer ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_ResizePacket' {$ENDIF} {$ENDIF}; +procedure SDLNet_FreePacket(packet: PUDPpacket); cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_FreePacket' {$ENDIF} {$ENDIF}; -procedure SDLNet_FreePacket( packet : PUDPpacket ); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_FreePacket' {$ENDIF} {$ENDIF}; +{ * Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets, + each 'size' bytes long. + A pointer to the first packet in the array is returned, or NULL if the + function ran out of memory. + * } +function SDLNet_AllocPacketV(howmany: integer; size: integer): PUDPpacket; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_AllocPacketV' {$ENDIF} {$ENDIF}; -{* Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets, - each 'size' bytes long. - A pointer to the first packet in the array is returned, or NULL if the - function ran out of memory. - *} -function SDLNet_AllocPacketV( howmany : integer; size : integer ) : PUDPpacket; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_AllocPacketV' {$ENDIF} {$ENDIF}; +procedure SDLNet_FreePacketV(packetV: PUDPpacket); cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_FreePacketV' {$ENDIF} {$ENDIF}; -procedure SDLNet_FreePacketV( packetV : PUDPpacket ); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_FreePacketV' {$ENDIF} {$ENDIF}; +{ * Open a UDP network socket + If 'port' is non-zero, the UDP socket is bound to a local port. + This allows other systems to send to this socket via a known port. + * } +function SDLNet_UDP_Open(port: Uint16): PUDPSocket; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Open' {$ENDIF} {$ENDIF}; -{* Open a UDP network socket - If 'port' is non-zero, the UDP socket is bound to a local port. - This allows other systems to send to this socket via a known port. -*} -function SDLNet_UDP_Open( port : Uint16 ) : PUDPsocket; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Open' {$ENDIF} {$ENDIF}; +{ * Bind the address 'address' to the requested channel on the UDP socket. + If the channel is -1, then the first unbound channel will be bound with + the given address as it's primary address. + If the channel is already bound, this new address will be added to the + list of valid source addresses for packets arriving on the channel. + If the channel is not already bound, then the address becomes the primary + address, to which all outbound packets on the channel are sent. + This function returns the channel which was bound, or -1 on error. + * } +function SDLNet_UDP_Bind(sock: PUDPSocket; channel: integer; var address: TIPAddress): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Bind' {$ENDIF} {$ENDIF}; -{* Bind the address 'address' to the requested channel on the UDP socket. - If the channel is -1, then the first unbound channel will be bound with - the given address as it's primary address. - If the channel is already bound, this new address will be added to the - list of valid source addresses for packets arriving on the channel. - If the channel is not already bound, then the address becomes the primary - address, to which all outbound packets on the channel are sent. - This function returns the channel which was bound, or -1 on error. -*} -function SDLNet_UDP_Bind( sock : PUDPsocket; channel : integer; var address : TIPaddress ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Bind' {$ENDIF} {$ENDIF}; +{ * Unbind all addresses from the given channel * } +procedure SDLNet_UDP_Unbind(sock: PUDPSocket; channel: integer); cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Unbind' {$ENDIF} {$ENDIF}; -{* Unbind all addresses from the given channel *} -procedure SDLNet_UDP_Unbind( sock : PUDPsocket; channel : integer ); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Unbind' {$ENDIF} {$ENDIF}; +{ * Get the primary IP address of the remote system associated with the + socket and channel. If the channel is -1, then the primary IP port + of the UDP socket is returned -- this is only meaningful for sockets + opened with a specific port. + If the channel is not bound and not -1, this function returns NULL. + * } +function SDLNet_UDP_GetPeerAddress(sock: PUDPSocket; channel: integer): PIPAddress; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_GetPeerAddress' {$ENDIF} {$ENDIF}; -{* Get the primary IP address of the remote system associated with the - socket and channel. If the channel is -1, then the primary IP port - of the UDP socket is returned -- this is only meaningful for sockets - opened with a specific port. - If the channel is not bound and not -1, this function returns NULL. - *} -function SDLNet_UDP_GetPeerAddress( sock : PUDPsocket; channel : integer ) : PIPAddress; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_GetPeerAddress' {$ENDIF} {$ENDIF}; +{ * Send a vector of packets to the the channels specified within the packet. + If the channel specified in the packet is -1, the packet will be sent to + the address in the 'src' member of the packet. + Each packet will be updated with the status of the packet after it has + been sent, -1 if the packet send failed. + This function returns the number of packets sent. + * } +function SDLNet_UDP_SendV(sock: PUDPSocket; packets: PPUDPpacket; npackets: integer): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_SendV' {$ENDIF} {$ENDIF}; -{* Send a vector of packets to the the channels specified within the packet. - If the channel specified in the packet is -1, the packet will be sent to - the address in the 'src' member of the packet. - Each packet will be updated with the status of the packet after it has - been sent, -1 if the packet send failed. - This function returns the number of packets sent. -*} -function SDLNet_UDP_SendV( sock : PUDPsocket; packets : PPUDPpacket; npackets : integer ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_SendV' {$ENDIF} {$ENDIF}; +{ * Send a single packet to the specified channel. + If the channel specified in the packet is -1, the packet will be sent to + the address in the 'src' member of the packet. + The packet will be updated with the status of the packet after it has + been sent. + This function returns 1 if the packet was sent, or 0 on error. + * } +function SDLNet_UDP_Send(sock: PUDPSocket; channel: integer; packet: PUDPpacket): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Send' {$ENDIF} {$ENDIF}; -{* Send a single packet to the specified channel. - If the channel specified in the packet is -1, the packet will be sent to - the address in the 'src' member of the packet. - The packet will be updated with the status of the packet after it has - been sent. - This function returns 1 if the packet was sent, or 0 on error. -*} -function SDLNet_UDP_Send( sock : PUDPsocket; channel : integer; packet : PUDPpacket ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Send' {$ENDIF} {$ENDIF}; +{ * Receive a vector of pending packets from the UDP socket. + The returned packets contain the source address and the channel they arrived + on. If they did not arrive on a bound channel, the the channel will be set + to -1. + The channels are checked in highest to lowest order, so if an address is + bound to multiple channels, the highest channel with the source address + bound will be returned. + This function returns the number of packets read from the network, or -1 + on error. This function does not block, so can return 0 packets pending. + * } +function SDLNet_UDP_RecvV(sock: PUDPSocket; packets: PPUDPpacket): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_RecvV' +{$ENDIF} {$ENDIF}; -{* Receive a vector of pending packets from the UDP socket. - The returned packets contain the source address and the channel they arrived - on. If they did not arrive on a bound channel, the the channel will be set - to -1. - The channels are checked in highest to lowest order, so if an address is - bound to multiple channels, the highest channel with the source address - bound will be returned. - This function returns the number of packets read from the network, or -1 - on error. This function does not block, so can return 0 packets pending. -*} -function SDLNet_UDP_RecvV( sock : PUDPsocket; packets : PPUDPpacket ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_RecvV' {$ENDIF} {$ENDIF}; +{ * Receive a single packet from the UDP socket. + The returned packet contains the source address and the channel it arrived + on. If it did not arrive on a bound channel, the the channel will be set + to -1. + The channels are checked in highest to lowest order, so if an address is + bound to multiple channels, the highest channel with the source address + bound will be returned. + This function returns the number of packets read from the network, or -1 + on error. This function does not block, so can return 0 packets pending. + * } +function SDLNet_UDP_Recv(sock: PUDPSocket; packet: PUDPpacket): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Recv' +{$ENDIF} {$ENDIF}; -{* Receive a single packet from the UDP socket. - The returned packet contains the source address and the channel it arrived - on. If it did not arrive on a bound channel, the the channel will be set - to -1. - The channels are checked in highest to lowest order, so if an address is - bound to multiple channels, the highest channel with the source address - bound will be returned. - This function returns the number of packets read from the network, or -1 - on error. This function does not block, so can return 0 packets pending. -*} -function SDLNet_UDP_Recv( sock : PUDPsocket; packet : PUDPpacket ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Recv' {$ENDIF} {$ENDIF}; +{ * Close a UDP network socket * } +procedure SDLNet_UDP_Close(sock: PUDPSocket); cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Close' {$ENDIF} {$ENDIF}; -{* Close a UDP network socket *} -procedure SDLNet_UDP_Close( sock : PUDPsocket ); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Close' {$ENDIF} {$ENDIF}; +{ *********************************************************************** } +{ * Hooks for checking sockets for available data * } +{ *********************************************************************** } - {***********************************************************************} - {* Hooks for checking sockets for available data *} - {***********************************************************************} +{ * Allocate a socket set for use with SDLNet_CheckSockets() + This returns a socket set for up to 'maxsockets' sockets, or NULL if + the function ran out of memory. + * } +function SDLNet_AllocSocketSet(maxsockets: integer): PSDLNet_SocketSet; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_AllocSocketSet' {$ENDIF} {$ENDIF}; -{* Allocate a socket set for use with SDLNet_CheckSockets() - This returns a socket set for up to 'maxsockets' sockets, or NULL if - the function ran out of memory. - *} -function SDLNet_AllocSocketSet( maxsockets : integer ) : PSDLNet_SocketSet; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_AllocSocketSet' {$ENDIF} {$ENDIF}; +{ * Add a socket to a set of sockets to be checked for available data * } +function SDLNet_AddSocket(set_: PSDLNet_SocketSet; sock: PSDLNet_GenericSocket): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_AddSocket' {$ENDIF} {$ENDIF}; -{* Add a socket to a set of sockets to be checked for available data *} -function SDLNet_AddSocket( set_ : PSDLNet_SocketSet; sock : PSDLNet_GenericSocket ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_AddSocket' {$ENDIF} {$ENDIF}; +function SDLNet_TCP_AddSocket(set_: PSDLNet_SocketSet; sock: PTCPSocket): integer; -function SDLNet_TCP_AddSocket( set_ : PSDLNet_SocketSet; sock : PTCPSocket ) : integer; +function SDLNet_UDP_AddSocket(set_: PSDLNet_SocketSet; sock: PUDPSocket): integer; -function SDLNet_UDP_AddSocket( set_ : PSDLNet_SocketSet; sock : PUDPSocket ) : integer; +{ * Remove a socket from a set of sockets to be checked for available data * } +function SDLNet_DelSocket(set_: PSDLNet_SocketSet; sock: PSDLNet_GenericSocket): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_DelSocket' {$ENDIF} {$ENDIF}; +function SDLNet_TCP_DelSocket(set_: PSDLNet_SocketSet; sock: PTCPSocket): integer; -{* Remove a socket from a set of sockets to be checked for available data *} -function SDLNet_DelSocket( set_ : PSDLNet_SocketSet; sock : PSDLNet_GenericSocket ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_DelSocket' {$ENDIF} {$ENDIF}; +function SDLNet_UDP_DelSocket(set_: PSDLNet_SocketSet; sock: PUDPSocket): integer; -function SDLNet_TCP_DelSocket( set_ : PSDLNet_SocketSet; sock : PTCPSocket ) : integer; +{ * This function checks to see if data is available for reading on the + given set of sockets. If 'timeout' is 0, it performs a quick poll, + otherwise the function returns when either data is available for + reading, or the timeout in milliseconds has elapsed, which ever occurs + first. This function returns the number of sockets ready for reading, + or -1 if there was an error with the select() system call. + * } +function SDLNet_CheckSockets(set_: PSDLNet_SocketSet; timeout: Sint32): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_CheckSockets' {$ENDIF} {$ENDIF}; -function SDLNet_UDP_DelSocket( set_ : PSDLNet_SocketSet; sock : PUDPSocket ) : integer; +{ * After calling SDLNet_CheckSockets(), you can use this function on a + socket that was in the socket set, to find out if data is available + for reading. + * } +function SDLNet_SocketReady(sock: PSDLNet_GenericSocket): boolean; -{* This function checks to see if data is available for reading on the - given set of sockets. If 'timeout' is 0, it performs a quick poll, - otherwise the function returns when either data is available for - reading, or the timeout in milliseconds has elapsed, which ever occurs - first. This function returns the number of sockets ready for reading, - or -1 if there was an error with the select() system call. -*} -function SDLNet_CheckSockets( set_ : PSDLNet_SocketSet; timeout : Sint32 ) : integer; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_CheckSockets' {$ENDIF} {$ENDIF}; +{ * Free a set of sockets allocated by SDL_NetAllocSocketSet() * } +procedure SDLNet_FreeSocketSet(set_: PSDLNet_SocketSet); cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_FreeSocketSet' {$ENDIF} {$ENDIF}; -{* After calling SDLNet_CheckSockets(), you can use this function on a - socket that was in the socket set, to find out if data is available - for reading. -*} -function SDLNet_SocketReady( sock : PSDLNet_GenericSocket ) : boolean; +{ *********************************************************************** } +{ * Platform-independent data conversion functions * } +{ *********************************************************************** } -{* Free a set of sockets allocated by SDL_NetAllocSocketSet() *} -procedure SDLNet_FreeSocketSet( set_ : PSDLNet_SocketSet ); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_FreeSocketSet' {$ENDIF} {$ENDIF}; +{ * Write a 16/32 bit value to network packet buffer * } +procedure SDLNet_Write16(value: Uint16; area: Pointer); cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Write16' {$ENDIF} {$ENDIF}; -{***********************************************************************} -{* Platform-independent data conversion functions *} -{***********************************************************************} +procedure SDLNet_Write32(value: Uint32; area: Pointer); cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Write32' {$ENDIF} {$ENDIF}; -{* Write a 16/32 bit value to network packet buffer *} -procedure SDLNet_Write16( value : Uint16; area : Pointer ); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Write16' {$ENDIF} {$ENDIF}; - -procedure SDLNet_Write32( value : Uint32; area : Pointer ); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Write32' {$ENDIF} {$ENDIF}; - -{* Read a 16/32 bit value from network packet buffer *} -function SDLNet_Read16( area : Pointer ) : Uint16; -//{$IFNDEF CPUARM} +{ * Read a 16/32 bit value from network packet buffer * } +function SDLNet_Read16(area: Pointer): Uint16; +// {$IFNDEF CPUARM} cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Read16' {$ENDIF} {$ENDIF}; -//{$ENDIF} +// {$ENDIF} -function SDLNet_Read32( area : Pointer ) : Uint32; -//{$IFNDEF CPUARM} +function SDLNet_Read32(area: Pointer): Uint32; +// {$IFNDEF CPUARM} cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_Read32' {$ENDIF} {$ENDIF}; -//{$ENDIF} +// {$ENDIF} -{***********************************************************************} -{* Error reporting functions *} -{***********************************************************************} +{ *********************************************************************** } +{ * Error reporting functions * } +{ *********************************************************************** } -{* We'll use SDL's functions for error reporting *} -procedure SDLNet_SetError( fmt : PChar ); -function SDLNet_GetError() : PChar; +{ * We'll use SDL's functions for error reporting * } +procedure SDLNet_SetError(fmt: PChar); +function SDLNet_GetError(): PChar; (* I'm eventually going to try to disentangle SDL_net from SDL, thus making - SDL_net an independent X-platform networking toolkit. Not today though.... + SDL_net an independent X-platform networking toolkit. Not today though.... -proceudre SDLNet_SetError(const char *fmt, ...); -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_SetError' {$ENDIF} {$ENDIF}; + proceudre SDLNet_SetError(const char *fmt, ...); + cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_SetError' {$ENDIF} {$ENDIF}; -function SDLNet_GetError() : PChar; -cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_GetError' {$ENDIF} {$ENDIF}; + function SDLNet_GetError() : PChar; + cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_GetError' {$ENDIF} {$ENDIF}; *) -//****************************************************************************** -//****************************************************************************** -//****************************************************************************** -//****************************************************************************** -//****************************************************************************** - - - - +// ****************************************************************************** +// ****************************************************************************** +// ****************************************************************************** +// ****************************************************************************** +// ****************************************************************************** implementation -//****************************************************************************** +// ****************************************************************************** -procedure SDL_NET_VERSION( var X : TSDL_version ); +procedure SDL_NET_VERSION(var X: TSDL_version); begin - X.major := SDL_NET_MAJOR_VERSION; - X.minor := SDL_NET_MINOR_VERSION; - X.patch := SDL_NET_PATCHLEVEL; + X.major := SDL_NET_MAJOR_VERSION; + X.minor := SDL_NET_MINOR_VERSION; + X.patch := SDL_NET_PATCHLEVEL; end; -//****************************************************************************** +// ****************************************************************************** -function SDLNet_TCP_AddSocket( set_ : PSDLNet_SocketSet; sock : PTCPSocket ) : integer; +function SDLNet_TCP_AddSocket(set_: PSDLNet_SocketSet; sock: PTCPSocket): integer; begin - result := SDLNet_AddSocket( set_, PSDLNet_GenericSocket( sock ) ); + result := SDLNet_AddSocket(set_, PSDLNet_GenericSocket(sock)); end; -//****************************************************************************** -function SDLNet_UDP_AddSocket( set_ : PSDLNet_SocketSet; sock : PUDPSocket ) : integer; +// ****************************************************************************** +function SDLNet_UDP_AddSocket(set_: PSDLNet_SocketSet; sock: PUDPSocket): integer; begin - result := SDLNet_AddSocket( set_, PSDLNet_GenericSocket( sock ) ); + result := SDLNet_AddSocket(set_, PSDLNet_GenericSocket(sock)); end; -//****************************************************************************** -function SDLNet_TCP_DelSocket( set_ : PSDLNet_SocketSet; sock : PTCPSocket ) : integer; +// ****************************************************************************** +function SDLNet_TCP_DelSocket(set_: PSDLNet_SocketSet; sock: PTCPSocket): integer; begin - result := SDLNet_DelSocket( set_, PSDLNet_GenericSocket( sock ) ); + result := SDLNet_DelSocket(set_, PSDLNet_GenericSocket(sock)); end; -//****************************************************************************** -function SDLNet_UDP_DelSocket( set_ : PSDLNet_SocketSet; sock : PUDPSocket ) : integer; +// ****************************************************************************** +function SDLNet_UDP_DelSocket(set_: PSDLNet_SocketSet; sock: PUDPSocket): integer; begin - result := SDLNet_DelSocket( set_, PSDLNet_GenericSocket( sock ) ); + result := SDLNet_DelSocket(set_, PSDLNet_GenericSocket(sock)); end; -//****************************************************************************** +// ****************************************************************************** -{* After calling SDLNet_CheckSockets(), you can use this function on a - socket that was in the socket set, to find out if data is available - for reading. -*} -function SDLNet_SocketReady( sock : PSDLNet_GenericSocket ) : boolean; +{ * After calling SDLNet_CheckSockets(), you can use this function on a + socket that was in the socket set, to find out if data is available + for reading. + * } +function SDLNet_SocketReady(sock: PSDLNet_GenericSocket): boolean; begin - result := ( ( sock <> nil ) and ( sock^.ready = 1 ) ); + result := ((sock <> nil) and (sock^.ready = 1)); end; -//****************************************************************************** +// ****************************************************************************** -procedure SDLNet_SetError( fmt : PChar ); +procedure SDLNet_SetError(fmt: PChar); begin - SDL_SetError( fmt ); + SDL_SetError(fmt); end; -//****************************************************************************** +// ****************************************************************************** -function SDLNet_GetError() : PChar; +function SDLNet_GetError(): PChar; begin - result := SDL_GetError; + result := SDL_GetError; end; -//****************************************************************************** +// ****************************************************************************** -//{$IFDEF CPUARM} -//function SDLNet_Read16( area : Pointer ) : Uint16; -//begin -// result := ((PUint8(area)^ shl 8) or (PUint8(area+1)^ shl 0)); -//end; +// {$IFDEF CPUARM} +// function SDLNet_Read16( area : Pointer ) : Uint16; +// begin +// result := ((PUint8(area)^ shl 8) or (PUint8(area+1)^ shl 0)); +// end; -//****************************************************************************** +// ****************************************************************************** -//function SDLNet_Read32( area : Pointer ) : Uint32; -//begin -// result := ((PUint8(area)^ shl 24) or (PUint8(area+1)^ shl 16) or (PUint8(area+2)^ shl 8) or (PUint8(area+3)^ shl 0) ); -//end; -//{$ENDIF} +// function SDLNet_Read32( area : Pointer ) : Uint32; +// begin +// result := ((PUint8(area)^ shl 24) or (PUint8(area+1)^ shl 16) or (PUint8(area+2)^ shl 8) or (PUint8(area+3)^ shl 0) ); +// end; +// {$ENDIF} end. - diff --git a/source/sdl2/SDL2_Ttf.pas b/source/sdl2/SDL2_Ttf.pas index 65ea6b5..6caf45b 100644 --- a/source/sdl2/SDL2_Ttf.pas +++ b/source/sdl2/SDL2_Ttf.pas @@ -24,7 +24,11 @@ interface uses {$IFDEF MSWINDOWS} +{$IFDEF FPC} + Windows, +{$ELSE} Winapi.Windows, +{$ENDIF} {$ENDIF} SDL2; diff --git a/source/utils/uResourcePaths.pas b/source/utils/uResourcePaths.pas index d8c1a44..2ee79f6 100644 --- a/source/utils/uResourcePaths.pas +++ b/source/utils/uResourcePaths.pas @@ -15,7 +15,7 @@ function cResourceResult: AnsiString; implementation uses - System.SysUtils; + SysUtils; function cResourceResult: AnsiString; begin