Signed-off-by: Laentir Valetov <laex@bk.ru>
This commit is contained in:
Laentir Valetov 2019-09-16 15:29:05 +04:00
parent 66dab5caee
commit 9a5de509ee
35 changed files with 3236 additions and 2531 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
#Directories
buildtest
backup/
__history/
__recovery/
Debug/

View File

@ -1,6 +1,6 @@
# Delphi-OpenCV
* OpenCV version - 2.4.13<br>
* Development environment - Delphi 2010-10.3<br>
* Development environment - Delphi 2010-10.3, FPC<br>
<b>Contributors:</b>

View File

@ -0,0 +1,67 @@
<?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="cvSetImageROI_cvAddWeighted"/>
<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>

View File

@ -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;
// уанавливаем облccть интереcа
cvSetImageROI(image, cvRect(x, y, width, height));
// взвешенная cумма
cvAddWeighted(image, alpha, templ, beta, 0.0, dst);
// ообождаем облccть интереcа
cvResetImageROI(image);
// показываем результат
cvShowImage('res', dst);
// ждём нажатия клавиши
cvWaitKey(0);
// ообождаем реcур
cvReleaseImage(image);
cvReleaseImage(templ);
cvReleaseImage(dst);
cvDestroyAllWindows();
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.

View File

@ -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>

View File

@ -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>

View File

@ -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.

View File

@ -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>

Binary file not shown.

View File

@ -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}

View File

@ -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.

View File

@ -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 }

View File

@ -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;

View File

@ -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.

View File

@ -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.

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -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.

File diff suppressed because it is too large Load Diff

View File

@ -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' +

View File

@ -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 }

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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];

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -24,7 +24,11 @@ interface
uses
{$IFDEF MSWINDOWS}
{$IFDEF FPC}
Windows,
{$ELSE}
Winapi.Windows,
{$ENDIF}
{$ENDIF}
SDL2;

View File

@ -15,7 +15,7 @@ function cResourceResult: AnsiString;
implementation
uses
System.SysUtils;
SysUtils;
function cResourceResult: AnsiString;
begin