mirror of
https://github.com/Laex/Delphi-OpenCV.git
synced 2024-11-15 07:45:53 +01:00
Refactoring opencv_classes
Signed-off-by: Laentir Valetov <laex@bk.ru>
This commit is contained in:
parent
d1b1b67d99
commit
d219c19bf9
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,11 +6,12 @@ Release
|
|||||||
ipch
|
ipch
|
||||||
lib
|
lib
|
||||||
/resource/result/*.*
|
/resource/result/*.*
|
||||||
|
|
||||||
|
#Files
|
||||||
*.exe
|
*.exe
|
||||||
*.dll
|
*.dll
|
||||||
!opencv_classes2413d.dll
|
!opencv_classes2413d.dll
|
||||||
!opencv_classes2413.dll
|
!opencv_classes2413.dll
|
||||||
#Files
|
|
||||||
*.ini
|
*.ini
|
||||||
*.bsc
|
*.bsc
|
||||||
*.sdf
|
*.sdf
|
||||||
@ -41,4 +42,4 @@ lib
|
|||||||
*.local
|
*.local
|
||||||
*.identcache
|
*.identcache
|
||||||
*.cmd
|
*.cmd
|
||||||
*.stat
|
*.stat
|
Binary file not shown.
Binary file not shown.
@ -15,7 +15,7 @@
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$POINTERMATH ON}
|
{$POINTERMATH ON}
|
||||||
{_$DEFINE SAFELOADLIB}
|
{$DEFINE SAFELOADLIB}
|
||||||
{$DEFINE USE_STUB_FOR_MISS_FUNC}
|
{$DEFINE USE_STUB_FOR_MISS_FUNC}
|
||||||
|
|
||||||
{$WARN SYMBOL_DEPRECATED OFF}
|
{$WARN SYMBOL_DEPRECATED OFF}
|
||||||
|
@ -31,17 +31,20 @@ interface
|
|||||||
|
|
||||||
Uses
|
Uses
|
||||||
ocv.core.types_c,
|
ocv.core.types_c,
|
||||||
|
ocv.cls.core,
|
||||||
ocv.cls.types;
|
ocv.cls.types;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
TInputArrayOfIplImage = TArray<pIplImage>; // InputArrayOfArrays
|
TInputArrayOfIplImage = TArray<pIplImage>; // InputArrayOfArrays
|
||||||
|
TInputArrayOfMat = TArray<IMat>; // InputArrayOfArrays
|
||||||
TInputArrayOfInteger = TArray<Integer>; // InputArray
|
TInputArrayOfInteger = TArray<Integer>; // InputArray
|
||||||
|
|
||||||
IFaceRecognizer = interface(IOCVCommon)
|
IFaceRecognizer = interface(IOCVCommon)
|
||||||
['{199DE478-2C78-4347-B553-C062290C78D2}']
|
['{199DE478-2C78-4347-B553-C062290C78D2}']
|
||||||
// Trains a FaceRecognizer.
|
// Trains a FaceRecognizer.
|
||||||
// CV_WRAP virtual void train(InputArrayOfArrays src, InputArray labels) = 0;
|
// CV_WRAP virtual void train(InputArrayOfArrays src, InputArray labels) = 0;
|
||||||
procedure train(src: TInputArrayOfIplImage; labels: TInputArrayOfInteger);
|
procedure train(src: TInputArrayOfIplImage; labels: TInputArrayOfInteger); overload;
|
||||||
|
procedure train(src: TInputArrayOfMat; labels: TInputArrayOfInteger); overload;
|
||||||
|
|
||||||
// Updates a FaceRecognizer.
|
// Updates a FaceRecognizer.
|
||||||
// CV_WRAP void update(InputArrayOfArrays src, InputArray labels);
|
// CV_WRAP void update(InputArrayOfArrays src, InputArray labels);
|
||||||
@ -89,7 +92,8 @@ Type
|
|||||||
constructor createLBPHFaceRecognizer(radius: Integer = 1; neighbors: Integer = 8; grid_x: Integer = 8;
|
constructor createLBPHFaceRecognizer(radius: Integer = 1; neighbors: Integer = 8; grid_x: Integer = 8;
|
||||||
grid_y: Integer = 8; threshold: double = DBL_MAX);
|
grid_y: Integer = 8; threshold: double = DBL_MAX);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure train(src: TInputArrayOfIplImage; labels: TInputArrayOfInteger);
|
procedure train(src: TInputArrayOfIplImage; labels: TInputArrayOfInteger); overload;
|
||||||
|
procedure train(src: TInputArrayOfMat; labels: TInputArrayOfInteger); overload;
|
||||||
procedure update(src: TInputArrayOfIplImage; labels: TInputArrayOfInteger);
|
procedure update(src: TInputArrayOfIplImage; labels: TInputArrayOfInteger);
|
||||||
function predict(src: pIplImage): Integer; overload;
|
function predict(src: pIplImage): Integer; overload;
|
||||||
procedure predict(src: pIplImage; Var lab: Integer; var confidence: double); overload;
|
procedure predict(src: pIplImage; Var lab: Integer; var confidence: double); overload;
|
||||||
@ -103,7 +107,7 @@ Type
|
|||||||
{$IFDEF SAFELOADLIB}
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
type
|
type
|
||||||
TInitModule_contrib = function()cbool; cdecl;
|
TInitModule_contrib = function():cbool; cdecl;
|
||||||
|
|
||||||
var
|
var
|
||||||
InitModule_contrib: TInitModule_contrib;
|
InitModule_contrib: TInitModule_contrib;
|
||||||
@ -115,28 +119,6 @@ implementation
|
|||||||
|
|
||||||
uses ocv.lib;
|
uses ocv.lib;
|
||||||
|
|
||||||
{$IFDEF SAFELOADLIB}
|
|
||||||
|
|
||||||
Var
|
|
||||||
contribDLL: Cardinal;
|
|
||||||
|
|
||||||
procedure Init_opencv_contrib;
|
|
||||||
begin
|
|
||||||
contribDLL := ocvLoadLibrary(opencv_contrib_lib);
|
|
||||||
Assert(contribDLL <> 0, 'Can not init ' + opencv_contrib_lib);
|
|
||||||
|
|
||||||
InitModule_contrib := ocvGetProcAddress('?initModule_contrib@cv@@YA_NXZ', contribDLL);
|
|
||||||
end;
|
|
||||||
|
|
||||||
initialization
|
|
||||||
|
|
||||||
Init_opencv_contrib;
|
|
||||||
|
|
||||||
{$ELSE}
|
|
||||||
function InitModule_contrib; external opencv_contrib_lib name '?initModule_contrib@cv@@YA_NXZ';
|
|
||||||
{$ENDIF}
|
|
||||||
{ TFaceRecognizer }
|
|
||||||
|
|
||||||
// CV_EXPORTS_W Ptr<FaceRecognizer> createEigenFaceRecognizer(int num_components = 0, double threshold = DBL_MAX);
|
// CV_EXPORTS_W Ptr<FaceRecognizer> createEigenFaceRecognizer(int num_components = 0, double threshold = DBL_MAX);
|
||||||
function Create_EigenFaceRecognizer(num_components: Integer = 0; threshold: double = DBL_MAX): TOpenCVClass; stdcall;
|
function Create_EigenFaceRecognizer(num_components: Integer = 0; threshold: double = DBL_MAX): TOpenCVClass; stdcall;
|
||||||
external opencv_classes_lib name '_Create_EigenFaceRecognizer@12';
|
external opencv_classes_lib name '_Create_EigenFaceRecognizer@12';
|
||||||
@ -162,28 +144,29 @@ procedure FaceRecognizerPredict(const M: TOpenCVClass; scr: pIplImage; var _labe
|
|||||||
|
|
||||||
procedure FaceRecognizerTrain(const M: TOpenCVClass; const n: Integer; scr: Pointer; labels: Pointer); stdcall;
|
procedure FaceRecognizerTrain(const M: TOpenCVClass; const n: Integer; scr: Pointer; labels: Pointer); stdcall;
|
||||||
external opencv_classes_lib name '_FaceRecognizerTrain@16'; overload;
|
external opencv_classes_lib name '_FaceRecognizerTrain@16'; overload;
|
||||||
|
procedure FaceRecognizerTrainMat(const M: TOpenCVClass; const n: Integer; scr: Pointer; labels: Pointer); stdcall;
|
||||||
|
external opencv_classes_lib name '_FaceRecognizerTrain@16'; overload;
|
||||||
procedure FaceRecognizerUpdate(const M: TOpenCVClass; const n: Integer; scr: Pointer; labels: Pointer); stdcall;
|
procedure FaceRecognizerUpdate(const M: TOpenCVClass; const n: Integer; scr: Pointer; labels: Pointer); stdcall;
|
||||||
external opencv_classes_lib name '_FaceRecognizerUpdate@16';
|
external opencv_classes_lib name '_FaceRecognizerUpdate@16';
|
||||||
|
|
||||||
procedure _DestroyFaceRecognizer(const E: TOpenCVClass); stdcall;
|
procedure _DestroyFaceRecognizer(const E: TOpenCVClass); stdcall;
|
||||||
external opencv_classes_lib name '_DestroyFaceRecognizer@4';
|
external opencv_classes_lib name '_DestroyFaceRecognizer@4';
|
||||||
|
|
||||||
|
{ TFaceRecognizer }
|
||||||
|
|
||||||
constructor TFaceRecognizer.createEigenFaceRecognizer(num_components: Integer; threshold: double);
|
constructor TFaceRecognizer.createEigenFaceRecognizer(num_components: Integer; threshold: double);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create(Create_EigenFaceRecognizer(num_components, threshold));
|
||||||
FData := Create_EigenFaceRecognizer(num_components, threshold);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFaceRecognizer.createFisherFaceRecognizer(num_components: Integer; threshold: double);
|
constructor TFaceRecognizer.createFisherFaceRecognizer(num_components: Integer; threshold: double);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create(Create_FisherFaceRecognizer(num_components, threshold));
|
||||||
FData := Create_FisherFaceRecognizer(num_components, threshold);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFaceRecognizer.createLBPHFaceRecognizer(radius, neighbors, grid_x, grid_y: Integer; threshold: double);
|
constructor TFaceRecognizer.createLBPHFaceRecognizer(radius, neighbors, grid_x, grid_y: Integer; threshold: double);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create(Create_LBPHFaceRecognizer(radius, neighbors, grid_x, grid_y, threshold));
|
||||||
FData := Create_LBPHFaceRecognizer(radius, neighbors, grid_x, grid_y, threshold);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TFaceRecognizer.Destroy;
|
destructor TFaceRecognizer.Destroy;
|
||||||
@ -218,6 +201,17 @@ begin
|
|||||||
FaceRecognizerSave(FData, filename.AsPAnsiChar);
|
FaceRecognizerSave(FData, filename.AsPAnsiChar);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFaceRecognizer.train(src: TInputArrayOfMat; labels: TInputArrayOfInteger);
|
||||||
|
Var
|
||||||
|
src_mat: TArray<TOpenCVClass>;
|
||||||
|
i : Integer;
|
||||||
|
begin
|
||||||
|
SetLength(src_mat, Length(src));
|
||||||
|
for i := 0 to High(src_mat) do
|
||||||
|
src_mat[i] := src[i]._InternalData;
|
||||||
|
FaceRecognizerTrainMat(FData, Length(src), @src_mat[0], @labels[0]);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFaceRecognizer.train(src: TInputArrayOfIplImage; labels: TInputArrayOfInteger);
|
procedure TFaceRecognizer.train(src: TInputArrayOfIplImage; labels: TInputArrayOfInteger);
|
||||||
begin
|
begin
|
||||||
FaceRecognizerTrain(FData, Length(src), @src[0], @labels[0]);
|
FaceRecognizerTrain(FData, Length(src), @src[0], @labels[0]);
|
||||||
@ -228,4 +222,25 @@ begin
|
|||||||
FaceRecognizerUpdate(FData, Length(src), @src[0], @labels[0]);
|
FaceRecognizerUpdate(FData, Length(src), @src[0], @labels[0]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
Var
|
||||||
|
contribDLL: Cardinal;
|
||||||
|
|
||||||
|
procedure Init_opencv_contrib;
|
||||||
|
begin
|
||||||
|
contribDLL := ocvLoadLibrary(opencv_contrib_lib);
|
||||||
|
Assert(contribDLL <> 0, 'Can not init ' + opencv_contrib_lib);
|
||||||
|
|
||||||
|
InitModule_contrib := ocvGetProcAddress('?initModule_contrib@cv@@YA_NXZ', contribDLL);
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
|
||||||
|
Init_opencv_contrib;
|
||||||
|
|
||||||
|
{$ELSE}
|
||||||
|
function InitModule_contrib; external opencv_contrib_lib name '?initModule_contrib@cv@@YA_NXZ';
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -40,8 +40,6 @@ Type
|
|||||||
|
|
||||||
TSize = class(TOCVCommon, ISize)
|
TSize = class(TOCVCommon, ISize)
|
||||||
public
|
public
|
||||||
constructor Create(const OpenCVClass: TOpenCVClass);
|
|
||||||
destructor Destroy; override;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
IRect2i = interface(IOCVCommon)
|
IRect2i = interface(IOCVCommon)
|
||||||
@ -64,7 +62,17 @@ Type
|
|||||||
\return the previous state
|
\return the previous state
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS bool setBreakOnError(bool flag);
|
// CV_EXPORTS bool setBreakOnError(bool flag);
|
||||||
|
|
||||||
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TsetBreakOnError = function(flag: cbool): cbool; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
setBreakOnError: TsetBreakOnError;
|
||||||
|
{$ELSE}
|
||||||
function setBreakOnError(flag: cbool): cbool; cdecl;
|
function setBreakOnError(flag: cbool): cbool; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
(*
|
(*
|
||||||
typedef int (CV_CDECL *ErrorCallback)( int status, const char* func_name,
|
typedef int (CV_CDECL *ErrorCallback)( int status, const char* func_name,
|
||||||
@ -86,18 +94,54 @@ type
|
|||||||
\return the previous error handler
|
\return the previous error handler
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback, void* userdata=0, void** prevUserdata=0);
|
// CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback, void* userdata=0, void** prevUserdata=0);
|
||||||
|
|
||||||
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TredirectError = function(errCallback: TErrorCallback; userdata: pointer = nil; prevUserdata: PPointer = nil)
|
||||||
|
: TErrorCallback; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
redirectError: TredirectError;
|
||||||
|
{$ELSE}
|
||||||
function redirectError(errCallback: TErrorCallback; userdata: pointer = nil; prevUserdata: PPointer = nil)
|
function redirectError(errCallback: TErrorCallback; userdata: pointer = nil; prevUserdata: PPointer = nil)
|
||||||
: TErrorCallback; cdecl;
|
: TErrorCallback; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
// CV_EXPORTS void glob(String pattern, std::vector<String>& result, bool recursive = false);
|
// CV_EXPORTS void glob(String pattern, std::vector<String>& result, bool recursive = false);
|
||||||
|
|
||||||
// CV_EXPORTS_W void setNumThreads(int nthreads);
|
// CV_EXPORTS_W void setNumThreads(int nthreads);
|
||||||
procedure setNumThreads(nthreads: integer); cdecl;
|
{$IFDEF SAFELOADLIB}
|
||||||
// CV_EXPORTS_W int getNumThreads();
|
|
||||||
function getNumThreads(): integer; cdecl;
|
|
||||||
// CV_EXPORTS_W int getThreadNum();
|
|
||||||
function getThreadNum(): integer; cdecl;
|
|
||||||
|
|
||||||
|
type
|
||||||
|
TsetNumThreads = procedure(nthreads: integer); cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
setNumThreads: TsetNumThreads;
|
||||||
|
{$ELSE}
|
||||||
|
procedure setNumThreads(nthreads: integer); cdecl;
|
||||||
|
{$ENDIF}
|
||||||
|
// CV_EXPORTS_W int getNumThreads();
|
||||||
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TgetNumThreads = function(): integer; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
getNumThreads: TgetNumThreads;
|
||||||
|
{$ELSE}
|
||||||
|
function getNumThreads(): integer; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
|
// CV_EXPORTS_W int getThreadNum();
|
||||||
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TgetThreadNum = function: integer; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
getThreadNum: TgetThreadNum;
|
||||||
|
{$ELSE}
|
||||||
|
function getThreadNum(): integer; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
// CV_EXPORTS_W const string& getBuildInformation();
|
// CV_EXPORTS_W const string& getBuildInformation();
|
||||||
|
|
||||||
// ! Returns the number of ticks.
|
// ! Returns the number of ticks.
|
||||||
@ -109,8 +153,16 @@ function getThreadNum(): integer; cdecl;
|
|||||||
cv::getTickFrequency() to convert ticks to seconds.
|
cv::getTickFrequency() to convert ticks to seconds.
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS_W int64 getTickCount();
|
// CV_EXPORTS_W int64 getTickCount();
|
||||||
function getTickCount(): int64; cdecl;
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TgetTickCount = function: int64; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
getTickCount: TgetTickCount;
|
||||||
|
{$ELSE}
|
||||||
|
function getTickCount(): int64; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
(* !
|
(* !
|
||||||
Returns the number of ticks per seconds.
|
Returns the number of ticks per seconds.
|
||||||
|
|
||||||
@ -124,8 +176,16 @@ function getTickCount(): int64; cdecl;
|
|||||||
\endcode
|
\endcode
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS_W double getTickFrequency();
|
// CV_EXPORTS_W double getTickFrequency();
|
||||||
function getTickFrequency(): double; cdecl;
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TgetTickFrequency = function: double; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
getTickFrequency: TgetTickFrequency;
|
||||||
|
{$ELSE}
|
||||||
|
function getTickFrequency(): double; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
(* !
|
(* !
|
||||||
Returns the number of CPU ticks.
|
Returns the number of CPU ticks.
|
||||||
|
|
||||||
@ -135,8 +195,16 @@ function getTickFrequency(): double; cdecl;
|
|||||||
for which cv::getTickCount() granularity is not enough.
|
for which cv::getTickCount() granularity is not enough.
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS_W int64 getCPUTickCount();
|
// CV_EXPORTS_W int64 getCPUTickCount();
|
||||||
function getCPUTickCount(): int64; cdecl;
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TgetCPUTickCount = function: int64; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
getCPUTickCount: TgetCPUTickCount;
|
||||||
|
{$ELSE}
|
||||||
|
function getCPUTickCount(): int64; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
(* !
|
(* !
|
||||||
Returns SSE etc. support status
|
Returns SSE etc. support status
|
||||||
|
|
||||||
@ -158,12 +226,28 @@ function getCPUTickCount(): int64; cdecl;
|
|||||||
until you call cv::useOptimized(true)}
|
until you call cv::useOptimized(true)}
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS_W bool checkHardwareSupport(int feature);
|
// CV_EXPORTS_W bool checkHardwareSupport(int feature);
|
||||||
function checkHardwareSupport(feature: integer): cbool; cdecl;
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TcheckHardwareSupport = function(feature: integer): cbool; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
checkHardwareSupport: TcheckHardwareSupport;
|
||||||
|
{$ELSE}
|
||||||
|
function checkHardwareSupport(feature: integer): cbool; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
// ! returns the number of CPUs (including hyper-threading)
|
// ! returns the number of CPUs (including hyper-threading)
|
||||||
// CV_EXPORTS_W int getNumberOfCPUs();
|
// CV_EXPORTS_W int getNumberOfCPUs();
|
||||||
function getNumberOfCPUs(): integer; cdecl;
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TgetNumberOfCPUs = function: integer; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
getNumberOfCPUs: TgetNumberOfCPUs;
|
||||||
|
{$ELSE}
|
||||||
|
function getNumberOfCPUs(): integer; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
(* !
|
(* !
|
||||||
Allocates memory buffer
|
Allocates memory buffer
|
||||||
|
|
||||||
@ -175,8 +259,16 @@ function getNumberOfCPUs(): integer; cdecl;
|
|||||||
\return the allocated memory buffer.
|
\return the allocated memory buffer.
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS void* fastMalloc(size_t bufSize);
|
// CV_EXPORTS void* fastMalloc(size_t bufSize);
|
||||||
function fastMalloc(bufSize: size_t): pointer; cdecl;
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TfastMalloc = function(bufSize: size_t): pointer; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
fastMalloc: TfastMalloc;
|
||||||
|
{$ELSE}
|
||||||
|
function fastMalloc(bufSize: size_t): pointer; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
(* !
|
(* !
|
||||||
Frees the memory allocated with cv::fastMalloc
|
Frees the memory allocated with cv::fastMalloc
|
||||||
|
|
||||||
@ -184,8 +276,16 @@ function fastMalloc(bufSize: size_t): pointer; cdecl;
|
|||||||
When ptr==NULL, the function has no effect.
|
When ptr==NULL, the function has no effect.
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS void fastFree(void * ptr);
|
// CV_EXPORTS void fastFree(void * ptr);
|
||||||
procedure fastFree(ptr: pointer); cdecl;
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TfastFree = procedure(ptr: pointer); cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
fastFree: TfastFree;
|
||||||
|
{$ELSE}
|
||||||
|
procedure fastFree(ptr: pointer); cdecl;
|
||||||
|
{$ENDIF}
|
||||||
(* !
|
(* !
|
||||||
Turns on/off available optimization
|
Turns on/off available optimization
|
||||||
|
|
||||||
@ -196,15 +296,32 @@ procedure fastFree(ptr: pointer); cdecl;
|
|||||||
to call this function anywhere in the code. Instead, call it somewhere at the top level.}
|
to call this function anywhere in the code. Instead, call it somewhere at the top level.}
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS_W void setUseOptimized(bool onoff);
|
// CV_EXPORTS_W void setUseOptimized(bool onoff);
|
||||||
procedure setUseOptimized(onoff: cbool); cdecl;
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TsetUseOptimized = procedure(onoff: cbool); cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
setUseOptimized: TsetUseOptimized;
|
||||||
|
{$ELSE}
|
||||||
|
procedure setUseOptimized(onoff: cbool); cdecl;
|
||||||
|
{$ENDIF}
|
||||||
(* !
|
(* !
|
||||||
Returns the current optimization status
|
Returns the current optimization status
|
||||||
|
|
||||||
The function returns the current optimization status, which is controlled by cv::setUseOptimized().
|
The function returns the current optimization status, which is controlled by cv::setUseOptimized().
|
||||||
*)
|
*)
|
||||||
// CV_EXPORTS_W bool useOptimized();
|
// CV_EXPORTS_W bool useOptimized();
|
||||||
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
|
type
|
||||||
|
TuseOptimized = function: cbool; cdecl;
|
||||||
|
|
||||||
|
var
|
||||||
|
useOptimized: TuseOptimized;
|
||||||
|
{$ELSE}
|
||||||
function useOptimized(): cbool; cdecl;
|
function useOptimized(): cbool; cdecl;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
Type
|
Type
|
||||||
|
|
||||||
@ -257,21 +374,6 @@ Uses
|
|||||||
ocv.core_c,
|
ocv.core_c,
|
||||||
ocv.lib;
|
ocv.lib;
|
||||||
|
|
||||||
function setBreakOnError; external core_lib;
|
|
||||||
function redirectError; external core_lib;
|
|
||||||
procedure setNumThreads; external core_lib;
|
|
||||||
function getNumThreads; external core_lib;
|
|
||||||
function getThreadNum; external core_lib;
|
|
||||||
function getTickCount; external core_lib;
|
|
||||||
function getTickFrequency; external core_lib;
|
|
||||||
function getCPUTickCount; external core_lib;
|
|
||||||
function checkHardwareSupport; external core_lib;
|
|
||||||
function getNumberOfCPUs; external core_lib;
|
|
||||||
function fastMalloc; external core_lib;
|
|
||||||
procedure fastFree; external core_lib;
|
|
||||||
procedure setUseOptimized; external core_lib;
|
|
||||||
function useOptimized; external core_lib;
|
|
||||||
|
|
||||||
// ------------------------------ Mat ------------------------------
|
// ------------------------------ Mat ------------------------------
|
||||||
function _CreateMat: TOpenCVClass; stdcall; external opencv_classes_lib name '_CreateMat@0';
|
function _CreateMat: TOpenCVClass; stdcall; external opencv_classes_lib name '_CreateMat@0';
|
||||||
function _GetMatData(const e: TOpenCVClass; index: integer; param: integer = 0): integer; stdcall;
|
function _GetMatData(const e: TOpenCVClass; index: integer; param: integer = 0): integer; stdcall;
|
||||||
@ -378,17 +480,51 @@ begin
|
|||||||
cvSetData(@Self, Mat.data, Mat.step1);
|
cvSetData(@Self, Mat.data, Mat.step1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSize }
|
{$IFDEF SAFELOADLIB}
|
||||||
|
|
||||||
constructor TSize.Create(const OpenCVClass: TOpenCVClass);
|
Var
|
||||||
|
coreDLL: Cardinal;
|
||||||
|
|
||||||
|
procedure Init_opencv_contrib;
|
||||||
begin
|
begin
|
||||||
FData := OpenCVClass;
|
coreDLL := ocvLoadLibrary(core_lib);
|
||||||
|
Assert(coreDLL <> 0, 'Can not init ' + core_lib);
|
||||||
|
|
||||||
|
setBreakOnError := ocvGetProcAddress('?setBreakOnError@cv@@YA_N_N@Z', coreDLL);
|
||||||
|
redirectError := ocvGetProcAddress('?redirectError@cv@@YAP6AHHPBD00HPAX@ZP6AHH000H1@Z1PAPAX@Z', coreDLL);
|
||||||
|
setNumThreads := ocvGetProcAddress('?setNumThreads@cv@@YAXH@Z', coreDLL);
|
||||||
|
getNumThreads := ocvGetProcAddress('?getNumThreads@cv@@YAHXZ', coreDLL);
|
||||||
|
getThreadNum := ocvGetProcAddress('?getThreadNum@cv@@YAHXZ', coreDLL);
|
||||||
|
getTickCount := ocvGetProcAddress('?getTickCount@cv@@YA_JXZ', coreDLL);
|
||||||
|
getTickFrequency := ocvGetProcAddress('?getTickFrequency@cv@@YANXZ', coreDLL);
|
||||||
|
getCPUTickCount := ocvGetProcAddress('?getCPUTickCount@cv@@YA_JXZ', coreDLL);
|
||||||
|
checkHardwareSupport := ocvGetProcAddress('?checkHardwareSupport@cv@@YA_NH@Z', coreDLL);
|
||||||
|
getNumberOfCPUs := ocvGetProcAddress('?getNumberOfCPUs@cv@@YAHXZ', coreDLL);
|
||||||
|
fastMalloc := ocvGetProcAddress('?fastMalloc@cv@@YAPAXI@Z', coreDLL);
|
||||||
|
fastFree := ocvGetProcAddress('?fastFree@cv@@YAXPAX@Z', coreDLL);
|
||||||
|
setUseOptimized := ocvGetProcAddress('?setUseOptimized@cv@@YAX_N@Z', coreDLL);
|
||||||
|
useOptimized := ocvGetProcAddress('?useOptimized@cv@@YA_NXZ', coreDLL);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TSize.Destroy;
|
initialization
|
||||||
begin
|
|
||||||
|
|
||||||
inherited;
|
Init_opencv_contrib;
|
||||||
end;
|
|
||||||
|
{$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';
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -31,30 +31,11 @@ interface
|
|||||||
|
|
||||||
Uses
|
Uses
|
||||||
Winapi.Windows,
|
Winapi.Windows,
|
||||||
System.Generics.Collections,
|
|
||||||
ocv.cls.types,
|
ocv.cls.types,
|
||||||
ocv.core.types_c,
|
ocv.core.types_c,
|
||||||
ocv.highgui_c,
|
ocv.cls.core;
|
||||||
ocv.cls.core,
|
|
||||||
ocv.cls.mat;
|
|
||||||
|
|
||||||
Type
|
Type
|
||||||
IMaskGenerator = interface(IOCVCommon)
|
|
||||||
['{DABEB77F-A919-49EB-999F-C1876812A330}']
|
|
||||||
end;
|
|
||||||
|
|
||||||
TMaskGenerator = class(TOCVCommon, IMaskGenerator)
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
// IFileNode = interface(IOCVCommon)
|
|
||||||
// ['{8BB056BF-08AE-4512-9861-4906D770C2A0}']
|
|
||||||
// end;
|
|
||||||
// TFileNode = class(TOCVCommon, IFileNode)
|
|
||||||
// end;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ICascadeClassifier = interface(IOCVCommon)
|
ICascadeClassifier = interface(IOCVCommon)
|
||||||
['{700C3DEC-F156-4014-9676-5BD9ECC3B01B}']
|
['{700C3DEC-F156-4014-9676-5BD9ECC3B01B}']
|
||||||
function empty(): cbool;
|
function empty(): cbool;
|
||||||
@ -73,7 +54,8 @@ Type
|
|||||||
function isOldFormatCascade(): cbool;
|
function isOldFormatCascade(): cbool;
|
||||||
function getOriginalWindowSize(): ISize;
|
function getOriginalWindowSize(): ISize;
|
||||||
function getFeatureType(): integer;
|
function getFeatureType(): integer;
|
||||||
// function convert(const oldcascade: String; const newcascade: String): cbool;
|
function setImage(Image: IMat): cbool;
|
||||||
|
// function convert(const oldcascade: String; const newcascade: String): cbool;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCascadeClassifier = class(TOCVCommon, ICascadeClassifier)
|
TCascadeClassifier = class(TOCVCommon, ICascadeClassifier)
|
||||||
@ -157,10 +139,10 @@ Type
|
|||||||
function isOldFormatCascade(): cbool;
|
function isOldFormatCascade(): cbool;
|
||||||
function getOriginalWindowSize(): ISize;
|
function getOriginalWindowSize(): ISize;
|
||||||
function getFeatureType(): integer;
|
function getFeatureType(): integer;
|
||||||
// function convert(const oldcascade: String; const newcascade: String): cbool;
|
function setImage(Image: IMat): cbool;
|
||||||
|
// function convert(const oldcascade: String; const newcascade: String): cbool;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
Uses
|
Uses
|
||||||
@ -180,16 +162,17 @@ function _CascadeClassifier_getOriginalWindowSize(CascadeClassifier: TOpenCVClas
|
|||||||
external opencv_classes_lib name '_CascadeClassifier_getOriginalWindowSize@4';
|
external opencv_classes_lib name '_CascadeClassifier_getOriginalWindowSize@4';
|
||||||
function _CascadeClassifier_getFeatureType(CascadeClassifier: TOpenCVClass): integer; stdcall;
|
function _CascadeClassifier_getFeatureType(CascadeClassifier: TOpenCVClass): integer; stdcall;
|
||||||
external opencv_classes_lib name '_CascadeClassifier_getFeatureType@4';
|
external opencv_classes_lib name '_CascadeClassifier_getFeatureType@4';
|
||||||
//function _CascadeClassifier_convert(CascadeClassifier: TOpenCVClass; oldcascade, newcascade: PAnsiChar): cbool; stdcall;
|
function _CascadeClassifier_setImage(CascadeClassifier: TOpenCVClass; m: TOpenCVClass): cbool; stdcall;
|
||||||
// external opencv_classes_lib name '_CascadeClassifier_convert@12';
|
external opencv_classes_lib name '_CascadeClassifier_setImage@8';
|
||||||
|
// function _CascadeClassifier_convert(CascadeClassifier: TOpenCVClass; oldcascade, newcascade: PAnsiChar): cbool; stdcall;
|
||||||
|
// external opencv_classes_lib name '_CascadeClassifier_convert@12';
|
||||||
|
|
||||||
{ ------------------------------ TCascadeClassifier ------------------------------ }
|
{ ------------------------------ TCascadeClassifier ------------------------------ }
|
||||||
|
|
||||||
//function TCascadeClassifier.convert(const oldcascade, newcascade: String): cbool;
|
// function TCascadeClassifier.convert(const oldcascade, newcascade: String): cbool;
|
||||||
//begin
|
// begin
|
||||||
// Result := _CascadeClassifier_convert(FData, oldcascade.AsPAnsiChar, newcascade.AsPAnsiChar);
|
// Result := _CascadeClassifier_convert(FData, oldcascade.AsPAnsiChar, newcascade.AsPAnsiChar);
|
||||||
//end;
|
// end;
|
||||||
|
|
||||||
constructor TCascadeClassifier.Create;
|
constructor TCascadeClassifier.Create;
|
||||||
begin
|
begin
|
||||||
@ -253,4 +236,9 @@ begin
|
|||||||
Result := _get_CascadeClassifier_load(FData, FileName.AsPAnsiChar);
|
Result := _get_CascadeClassifier_load(FData, FileName.AsPAnsiChar);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCascadeClassifier.setImage(Image: IMat): cbool;
|
||||||
|
begin
|
||||||
|
Result := _CascadeClassifier_setImage(FData, Image._InternalData);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -40,6 +40,7 @@ Type
|
|||||||
protected
|
protected
|
||||||
FData: TOpenCVClass;
|
FData: TOpenCVClass;
|
||||||
public
|
public
|
||||||
|
constructor Create(const OpenCVClass: TOpenCVClass);
|
||||||
function _InternalData: TOpenCVClass;
|
function _InternalData: TOpenCVClass;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -54,6 +55,11 @@ Uses ocv.utils;
|
|||||||
|
|
||||||
{ TOCVCommon }
|
{ TOCVCommon }
|
||||||
|
|
||||||
|
constructor TOCVCommon.Create(const OpenCVClass: TOpenCVClass);
|
||||||
|
begin
|
||||||
|
FData := OpenCVClass;
|
||||||
|
end;
|
||||||
|
|
||||||
function TOCVCommon._InternalData: TOpenCVClass;
|
function TOCVCommon._InternalData: TOpenCVClass;
|
||||||
begin
|
begin
|
||||||
Result := FData;
|
Result := FData;
|
||||||
|
@ -58,6 +58,18 @@ namespace cv
|
|||||||
e->train(images, labels);
|
e->train(images, labels);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ICLASS_API void __stdcall FaceRecognizerTrainMat(FaceRecognizer* e, int n, Mat** scr, int* lab)
|
||||||
|
{
|
||||||
|
vector<Mat> images;
|
||||||
|
vector<int> labels;
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
images.push_back(*scr[i]);
|
||||||
|
labels.push_back(lab[i]);
|
||||||
|
}
|
||||||
|
e->train(images, labels);
|
||||||
|
};
|
||||||
|
|
||||||
ICLASS_API void __stdcall FaceRecognizerUpdate(FaceRecognizer* e, int n, IplImage** scr, int* lab)
|
ICLASS_API void __stdcall FaceRecognizerUpdate(FaceRecognizer* e, int n, IplImage** scr, int* lab)
|
||||||
{
|
{
|
||||||
vector<Mat> images;
|
vector<Mat> images;
|
||||||
|
62
source/opencv_classes/core_prx.cpp
Normal file
62
source/opencv_classes/core_prx.cpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
namespace cv
|
||||||
|
{
|
||||||
|
//////////////////// Mat ////////////////////
|
||||||
|
ICLASS_API Mat* __stdcall CreateMat()
|
||||||
|
{
|
||||||
|
return new Mat;
|
||||||
|
};
|
||||||
|
ICLASS_API bool __stdcall MatEmpty(Mat* e)
|
||||||
|
{
|
||||||
|
return e->empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
ICLASS_API Mat* __stdcall CreateMatFromImage(IplImage* Image)
|
||||||
|
{
|
||||||
|
Mat *M = new Mat;
|
||||||
|
*M = cvarrToMat(Image);// default additional arguments: don't copy data.
|
||||||
|
//*M= Image;
|
||||||
|
return M;
|
||||||
|
}
|
||||||
|
|
||||||
|
ICLASS_API int __stdcall GetMatData(Mat* e, int index, int param)
|
||||||
|
{
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return (int)e->elemSize();
|
||||||
|
case 1:
|
||||||
|
return (int)e->elemSize1();
|
||||||
|
case 2:
|
||||||
|
return (int)e->type();
|
||||||
|
case 3:
|
||||||
|
return (int)e->depth();
|
||||||
|
case 4:
|
||||||
|
return (int)e->channels();
|
||||||
|
case 5:
|
||||||
|
return (int)e->step1(param);
|
||||||
|
case 6:
|
||||||
|
return (int)e->total();
|
||||||
|
case 7:
|
||||||
|
return (int)e->flags;
|
||||||
|
case 8:
|
||||||
|
return (int)e->dims;
|
||||||
|
case 9:
|
||||||
|
return (int)e->rows;
|
||||||
|
case 10:
|
||||||
|
return (int)e->cols;
|
||||||
|
case 11:
|
||||||
|
return (int)e->data;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ICLASS_API void __stdcall DestroyMat(Mat* e)
|
||||||
|
{
|
||||||
|
delete e;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
52
source/opencv_classes/highgui_prx.cpp
Normal file
52
source/opencv_classes/highgui_prx.cpp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
namespace cv
|
||||||
|
{
|
||||||
|
|
||||||
|
//////////////////// VidoCapture ////////////////////
|
||||||
|
ICLASS_API VideoCapture* __stdcall CreateVideoCapture()
|
||||||
|
{
|
||||||
|
return new VideoCapture;
|
||||||
|
};
|
||||||
|
|
||||||
|
ICLASS_API bool __stdcall VideoCaptureOpen(VideoCapture* e, int CamNumber)
|
||||||
|
{
|
||||||
|
return e->open(CamNumber);
|
||||||
|
};
|
||||||
|
|
||||||
|
ICLASS_API bool __stdcall VideoCaptureOpenFileName(VideoCapture* e, char* FileName)
|
||||||
|
{
|
||||||
|
return e->open(FileName);
|
||||||
|
};
|
||||||
|
|
||||||
|
ICLASS_API bool __stdcall VideoCaptureisOpened(VideoCapture* e)
|
||||||
|
{
|
||||||
|
return e->isOpened();
|
||||||
|
};
|
||||||
|
|
||||||
|
ICLASS_API bool __stdcall VideoCaptureRead(VideoCapture* e, Mat** M)
|
||||||
|
{
|
||||||
|
Mat *_M = new Mat;
|
||||||
|
bool r=e->read(*_M);
|
||||||
|
*M = _M;
|
||||||
|
return r;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
ICLASS_API bool __stdcall VideoCaptureSet(VideoCapture* e, int propId, double value)
|
||||||
|
{
|
||||||
|
return e->set(propId, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
ICLASS_API double __stdcall VideoCaptureGet(VideoCapture* e, int propId)
|
||||||
|
{
|
||||||
|
return e->get(propId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ICLASS_API void __stdcall DestroyVideoCapture(VideoCapture* e)
|
||||||
|
{
|
||||||
|
delete e;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
54
source/opencv_classes/objdetect_prx.cpp
Normal file
54
source/opencv_classes/objdetect_prx.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
namespace cv
|
||||||
|
{
|
||||||
|
//////////////////// CascadeClassifier ////////////////////
|
||||||
|
|
||||||
|
ICLASS_API CascadeClassifier* __stdcall CreateCascadeClassifier()
|
||||||
|
{
|
||||||
|
return new CascadeClassifier;
|
||||||
|
};
|
||||||
|
ICLASS_API void __stdcall DestroyCascadeClassifier(CascadeClassifier* e)
|
||||||
|
{
|
||||||
|
delete e;
|
||||||
|
};
|
||||||
|
|
||||||
|
ICLASS_API bool __stdcall get_CascadeClassifier_empty(CascadeClassifier* e)
|
||||||
|
{
|
||||||
|
return e->empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
ICLASS_API bool __stdcall get_CascadeClassifier_load(CascadeClassifier* e, char* filename)
|
||||||
|
{
|
||||||
|
return e->load(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ICLASS_API bool __stdcall CascadeClassifier_isOldFormatCascade(CascadeClassifier* e)
|
||||||
|
{
|
||||||
|
return e->isOldFormatCascade();
|
||||||
|
}
|
||||||
|
|
||||||
|
ICLASS_API Size* __stdcall CascadeClassifier_getOriginalWindowSize(CascadeClassifier* e)
|
||||||
|
{
|
||||||
|
Size *s = new Size(e->getOriginalWindowSize());
|
||||||
|
//*s = e->getOriginalWindowSize();
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
ICLASS_API int __stdcall CascadeClassifier_getFeatureType(CascadeClassifier* e)
|
||||||
|
{
|
||||||
|
return e->getFeatureType();
|
||||||
|
}
|
||||||
|
|
||||||
|
ICLASS_API int __stdcall CascadeClassifier_setImage(CascadeClassifier* e, Mat* m)
|
||||||
|
{
|
||||||
|
return e->setImage(*m);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ICLASS_API bool __stdcall CascadeClassifier_convert(CascadeClassifier* e, char* oldcascade, char* newcascade)
|
||||||
|
//{
|
||||||
|
// return e->convert(oldcascade, newcascade);
|
||||||
|
// }
|
||||||
|
}
|
@ -1,151 +0,0 @@
|
|||||||
// opencv_classes.cpp: îïðåäåëÿåò ýêñïîðòèðîâàííûå ôóíêöèè äëÿ ïðèëîæåíèÿ DLL.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
namespace cv
|
|
||||||
{
|
|
||||||
//////////////////// Mat ////////////////////
|
|
||||||
ICLASS_API Mat* __stdcall CreateMat()
|
|
||||||
{
|
|
||||||
return new Mat;
|
|
||||||
};
|
|
||||||
ICLASS_API bool __stdcall MatEmpty(Mat* e)
|
|
||||||
{
|
|
||||||
return e->empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
ICLASS_API Mat* __stdcall CreateMatFromImage(IplImage* Image)
|
|
||||||
{
|
|
||||||
Mat *M = new Mat;
|
|
||||||
*M = cvarrToMat(Image);// default additional arguments: don't copy data.
|
|
||||||
//*M= Image;
|
|
||||||
return M;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICLASS_API int __stdcall GetMatData(Mat* e, int index, int param)
|
|
||||||
{
|
|
||||||
switch (index)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
return (int)e->elemSize();
|
|
||||||
case 1:
|
|
||||||
return (int)e->elemSize1();
|
|
||||||
case 2:
|
|
||||||
return (int)e->type();
|
|
||||||
case 3:
|
|
||||||
return (int)e->depth();
|
|
||||||
case 4:
|
|
||||||
return (int)e->channels();
|
|
||||||
case 5:
|
|
||||||
return (int)e->step1(param);
|
|
||||||
case 6:
|
|
||||||
return (int)e->total();
|
|
||||||
case 7:
|
|
||||||
return (int)e->flags;
|
|
||||||
case 8:
|
|
||||||
return (int)e->dims;
|
|
||||||
case 9:
|
|
||||||
return (int)e->rows;
|
|
||||||
case 10:
|
|
||||||
return (int)e->cols;
|
|
||||||
case 11:
|
|
||||||
return (int)e->data;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ICLASS_API void __stdcall DestroyMat(Mat* e)
|
|
||||||
{
|
|
||||||
delete e;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////// VidoCapture ////////////////////
|
|
||||||
ICLASS_API VideoCapture* __stdcall CreateVideoCapture()
|
|
||||||
{
|
|
||||||
return new VideoCapture;
|
|
||||||
};
|
|
||||||
|
|
||||||
ICLASS_API bool __stdcall VideoCaptureOpen(VideoCapture* e, int CamNumber)
|
|
||||||
{
|
|
||||||
return e->open(CamNumber);
|
|
||||||
};
|
|
||||||
|
|
||||||
ICLASS_API bool __stdcall VideoCaptureOpenFileName(VideoCapture* e, char* FileName)
|
|
||||||
{
|
|
||||||
return e->open(FileName);
|
|
||||||
};
|
|
||||||
|
|
||||||
ICLASS_API bool __stdcall VideoCaptureisOpened(VideoCapture* e)
|
|
||||||
{
|
|
||||||
return e->isOpened();
|
|
||||||
};
|
|
||||||
|
|
||||||
ICLASS_API bool __stdcall VideoCaptureRead(VideoCapture* e, Mat** M)
|
|
||||||
{
|
|
||||||
Mat *_M = new Mat;
|
|
||||||
bool r=e->read(*_M);
|
|
||||||
*M = _M;
|
|
||||||
return r;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
ICLASS_API bool __stdcall VideoCaptureSet(VideoCapture* e, int propId, double value)
|
|
||||||
{
|
|
||||||
return e->set(propId, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
ICLASS_API double __stdcall VideoCaptureGet(VideoCapture* e, int propId)
|
|
||||||
{
|
|
||||||
return e->get(propId);
|
|
||||||
}
|
|
||||||
|
|
||||||
ICLASS_API void __stdcall DestroyVideoCapture(VideoCapture* e)
|
|
||||||
{
|
|
||||||
delete e;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////// CascadeClassifier ////////////////////
|
|
||||||
|
|
||||||
ICLASS_API CascadeClassifier* __stdcall CreateCascadeClassifier()
|
|
||||||
{
|
|
||||||
return new CascadeClassifier;
|
|
||||||
};
|
|
||||||
ICLASS_API void __stdcall DestroyCascadeClassifier(CascadeClassifier* e)
|
|
||||||
{
|
|
||||||
delete e;
|
|
||||||
};
|
|
||||||
|
|
||||||
ICLASS_API bool __stdcall get_CascadeClassifier_empty(CascadeClassifier* e)
|
|
||||||
{
|
|
||||||
return e->empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
ICLASS_API bool __stdcall get_CascadeClassifier_load(CascadeClassifier* e, char* filename)
|
|
||||||
{
|
|
||||||
return e->load(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ICLASS_API bool __stdcall CascadeClassifier_isOldFormatCascade(CascadeClassifier* e)
|
|
||||||
{
|
|
||||||
return e->isOldFormatCascade();
|
|
||||||
}
|
|
||||||
|
|
||||||
ICLASS_API Size* __stdcall CascadeClassifier_getOriginalWindowSize(CascadeClassifier* e)
|
|
||||||
{
|
|
||||||
Size *s = new Size(e->getOriginalWindowSize());
|
|
||||||
//*s = e->getOriginalWindowSize();
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICLASS_API int __stdcall CascadeClassifier_getFeatureType(CascadeClassifier* e)
|
|
||||||
{
|
|
||||||
return e->getFeatureType();
|
|
||||||
}
|
|
||||||
|
|
||||||
//ICLASS_API bool __stdcall CascadeClassifier_convert(CascadeClassifier* e, char* oldcascade, char* newcascade)
|
|
||||||
//{
|
|
||||||
// return e->convert(oldcascade, newcascade);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
@ -163,6 +163,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="contrib_prx.cpp" />
|
<ClCompile Include="contrib_prx.cpp" />
|
||||||
|
<ClCompile Include="core_prx.cpp" />
|
||||||
<ClCompile Include="dllmain.cpp">
|
<ClCompile Include="dllmain.cpp">
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
||||||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
||||||
@ -177,7 +178,8 @@
|
|||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="opencv_classes.cpp" />
|
<ClCompile Include="objdetect_prx.cpp" />
|
||||||
|
<ClCompile Include="highgui_prx.cpp" />
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
@ -29,14 +29,20 @@
|
|||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<Filter>Файлы исходного кода</Filter>
|
<Filter>Файлы исходного кода</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="opencv_classes.cpp">
|
|
||||||
<Filter>Файлы исходного кода</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="dllmain.cpp">
|
<ClCompile Include="dllmain.cpp">
|
||||||
<Filter>Файлы исходного кода</Filter>
|
<Filter>Файлы исходного кода</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="contrib_prx.cpp">
|
<ClCompile Include="contrib_prx.cpp">
|
||||||
<Filter>Файлы исходного кода</Filter>
|
<Filter>Файлы исходного кода</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="objdetect_prx.cpp">
|
||||||
|
<Filter>Файлы исходного кода</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="core_prx.cpp">
|
||||||
|
<Filter>Файлы исходного кода</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="highgui_prx.cpp">
|
||||||
|
<Filter>Файлы исходного кода</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user