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
@ -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,8 +450,8 @@ 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
@ -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,15 +602,13 @@ 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
@ -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
@ -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,14 +52,15 @@ unit ocv.core.types_c;
interface
Uses
{$IFDEF HAS_UNITSCOPE}
(*
Uses
{$IFDEF HAS_UNITSCOPE}
Winapi.Windows
{$ELSE}
{$ELSE}
Windows
{$ENDIF}
{$ENDIF}
;
*)
const
// Íàèìåíüøåå ÷èñëî äëÿ êîòîðîãî âûïîëíÿåòñÿ óñëîâèå 1.0+DBL_EPSILON <> 1.0
DBL_EPSILON = 2.2204460492503131E-016;
@ -325,9 +326,13 @@ const
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;
@ -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;
@ -774,7 +780,7 @@ type
TcvPoint2f = TCvPoint2D32f;
pcvPoint2f = pCvPoint2D32f;
TArrayOfcvPoint2f = TArray<TcvPoint2f>;
TArrayOfcvPoint2f = array of TcvPoint2f; // TArray<TcvPoint2f>;
pCvPoint3D32f = ^TCvPoint3D32f;
@ -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;
@ -899,7 +907,6 @@ type
free_space: Integer; (* Remaining free space in current block. *)
end;
type
pCvMemStoragePos = ^TCvMemStoragePos;
TCvMemStoragePos = record
@ -922,19 +929,23 @@ type
TCvSeqBlockArray = array [0 .. 0] of TCvSeqBlock;
pCvSeqBlockArray = ^TCvSeqBlockArray;
{$IFDEF FPC}generic{$ENDIF}
TCV_TREE_NODE_FIELDS<node_type> = record
{$IFDEF FPC}
type pnode_type = ^node_type;
public
{$ENDIF}
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. *)
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. *)
TCvSeq = record flags: Integer; (* Miscellaneous flags. *)
header_size: Integer; (* Size of sequence header. *)
h_prev: pCvSeq; (* Previous sequence. *)
h_next: pCvSeq; (* Next sequence. *)
@ -950,12 +961,14 @@ type
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>;
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. *)
@ -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;
@ -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

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

@ -526,10 +526,8 @@ 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}
combine = the flag with one of the above CV_THRESH_* values; *)
//{$EXTERNALSYM combine}
(* Adaptive threshold methods *)
CV_ADAPTIVE_THRESH_MEAN_C = 0;

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

@ -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
@ -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,5 +1,5 @@
unit SDL2_Net;
{*******************************************************************************
{ *******************************************************************************
SDL2_Net.pas v1.0 29/07/2013 first version for DelphiXE
v1.1 27/08/2013 add MACOS compability
@ -16,261 +16,250 @@ 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}
{$IFDEF MSWINDOWS}
SDL_NetLibName = 'SDL2_net.dll';
{$ENDIF}
{$IFDEF ANDROID}
{$ENDIF}
{$IFDEF ANDROID}
SDL_NetLibName = 'libSDL2_net.so';
{$ENDIF}
{$IFDEF MACOS}
{$IFDEF IOS}
{$ENDIF}
{$IFDEF MACOS}
{$IFDEF IOS}
SDL_NetLibName = 'libSDL2_net.a';
{$ELSE}
{$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_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.
{ * 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
{ 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 );
procedure SDL_NET_VERSION(var X: TSDL_version);
{* Initialize/Cleanup the network API
{ * 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};
* }
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.
{ * 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};
* }
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.
{ * 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};
* }
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
{ * 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};
* }
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.
{ * 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};
* }
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.
{ * 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};
* }
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'
{ * 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};
* }
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',
{ * 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};
* }
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.
{ * 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_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,
{ * 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};
* }
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
{ * 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};
* }
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.
{ * 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
@ -278,44 +267,39 @@ cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Op
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};
* }
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
{ * 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};
* }
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.
{ * 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};
* }
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.
{ * 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};
* }
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.
{ * 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.
@ -324,11 +308,11 @@ cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Se
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};
* }
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.
{ * 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.
@ -337,192 +321,178 @@ cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_UDP_Re
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};
* }
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()
{ * 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};
* }
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};
{* 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;
function SDLNet_TCP_DelSocket( set_ : PSDLNet_SocketSet; sock : PTCPSocket ) : integer;
function SDLNet_UDP_DelSocket(set_: PSDLNet_SocketSet; sock: PUDPSocket): integer;
function SDLNet_UDP_DelSocket( set_ : PSDLNet_SocketSet; sock : PUDPSocket ) : integer;
{* This function checks to see if data is available for reading on the
{ * 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_CheckSockets(set_: PSDLNet_SocketSet; timeout: Sint32): integer; cdecl; external SDL_NetLibName {$IFDEF MACOS} {$IFNDEF IOS} name '_SDLNet_CheckSockets' {$ENDIF} {$ENDIF};
{* After calling SDLNet_CheckSockets(), you can use this function on a
{ * 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;
* }
function SDLNet_SocketReady(sock: PSDLNet_GenericSocket): boolean;
{* 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};
{ * 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};
{***********************************************************************}
{* Platform-independent data conversion functions *}
{***********************************************************************}
{ *********************************************************************** }
{ * Platform-independent data conversion functions * }
{ *********************************************************************** }
{* 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};
{ * 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};
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....
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;
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
{ * 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;
* }
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;
end;
//******************************************************************************
// ******************************************************************************
//{$IFDEF CPUARM}
//function SDLNet_Read16( area : Pointer ) : Uint16;
//begin
// {$IFDEF CPUARM}
// function SDLNet_Read16( area : Pointer ) : Uint16;
// begin
// result := ((PUint8(area)^ shl 8) or (PUint8(area+1)^ shl 0));
//end;
// end;
//******************************************************************************
// ******************************************************************************
//function SDLNet_Read32( area : Pointer ) : Uint32;
//begin
// 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;
// {$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