diff --git a/.gitignore b/.gitignore index 1344d3d..e0670ac 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ CVAutoInstaller/ #Files *.exe -!CheckCVDep.exe +!/CheckCVDep/CheckCVDep.exe #*.dll *.ini *.bsc diff --git a/bin/Win32/CheckCVDep.exe b/bin/Win32/CheckCVDep.exe deleted file mode 100644 index 7a45551..0000000 Binary files a/bin/Win32/CheckCVDep.exe and /dev/null differ diff --git a/samples/Components/cCameraCapture/cCameraCapture.dproj b/samples/Components/cCameraCapture/cCameraCapture.dproj index 0473599..6aecabb 100644 --- a/samples/Components/cCameraCapture/cCameraCapture.dproj +++ b/samples/Components/cCameraCapture/cCameraCapture.dproj @@ -1,7 +1,7 @@ п»ї {9F27EBDE-3B7A-4B88-8E68-90DCA8A35F81} - 18.2 + 18.6 VCL cCameraCapture.dpr True @@ -192,7 +192,7 @@ Microsoft Office XP Sample Automation Server Wrapper Components - + True True diff --git a/samples/Components/cCameraCapture/cCameraCapture.res b/samples/Components/cCameraCapture/cCameraCapture.res index a143854..6416b7a 100644 Binary files a/samples/Components/cCameraCapture/cCameraCapture.res and b/samples/Components/cCameraCapture/cCameraCapture.res differ diff --git a/samples/Components/cCameraCapture/uMainForm.dfm b/samples/Components/cCameraCapture/uMainForm.dfm index b47a090..7532fd2 100644 --- a/samples/Components/cCameraCapture/uMainForm.dfm +++ b/samples/Components/cCameraCapture/uMainForm.dfm @@ -24,10 +24,6 @@ object MainForm: TMainForm VideoSource = ocvmgprtn1 Frames = <> Align = alClient - ExplicitLeft = 52 - ExplicitTop = 70 - ExplicitWidth = 285 - ExplicitHeight = 297 end object ocvmgprtn1: TocvImageOperation VideoSource = ocvcmrsrc1 diff --git a/source/component/ocv.comp.Source.pas b/source/component/ocv.comp.Source.pas index bafd311..158773d 100644 --- a/source/component/ocv.comp.Source.pas +++ b/source/component/ocv.comp.Source.pas @@ -136,7 +136,7 @@ type constructor Create(AOwner: TComponent); override; end; - TocvResolution = (r160x120, r320x240, r424x240, r640x360, r800x448, r960x544, r1280x720); + TocvResolution = (r160x120, r320x240, r424x240, r640x360, r800x448, r960x544, r1280x720, rCustom); TocvCameraSource = class(TocvCaptureSource) protected @@ -144,6 +144,8 @@ type private FCaptureSource: TocvCameraCaptureSource; FResolution: TocvResolution; + FCustomHeight: Cardinal; + FCustomWidth: Cardinal; procedure SetCameraSource(const Value: TocvCameraCaptureSource); procedure SetResolution(const Value: TocvResolution); procedure SetCameraResolution; @@ -152,6 +154,8 @@ type published property Camera: TocvCameraCaptureSource read FCaptureSource write SetCameraSource default CAP_ANY; property Resolution: TocvResolution read FResolution write SetResolution default r160x120; + property CustomWidth: Cardinal read FCustomWidth write FCustomWidth default 0; + property CustomHeight: Cardinal read FCustomHeight write FCustomHeight default 0; end; TocvFileSource = class(TocvCaptureSource) @@ -271,7 +275,7 @@ Type Const CameraResolution: array [TocvResolution] of TCameraResolution = ((cWidth: 160; cHeight: 120), (cWidth: 320; cHeight: 240), (cWidth: 424; cHeight: 240), (cWidth: 640; cHeight: 360), (cWidth: 800; cHeight: 448), (cWidth: 960; - cHeight: 544), (cWidth: 1280; cHeight: 720)); + cHeight: 544), (cWidth: 1280; cHeight: 720), (cWidth: 0; cHeight: 0)); { TOpenCVCameraThread } @@ -389,13 +393,27 @@ begin end; procedure TocvCameraSource.SetCameraResolution; +Var + cR: TCameraResolution; begin + if (FResolution = rCustom) then + begin + if (FCustomWidth > 0) and (FCustomHeight > 0) then + begin + cR.cWidth := FCustomWidth; + cR.cHeight := FCustomHeight; + end + else + cR := CameraResolution[r160x120]; + end + else + cR := CameraResolution[FResolution]; {$IFDEF DelphiOCVVersion_30} - FCapture.Prop[CV_CAP_PROP_FRAME_WIDTH] := CameraResolution[FResolution].cWidth; - FCapture.Prop[CV_CAP_PROP_FRAME_HEIGHT] := CameraResolution[FResolution].cHeight; + FCapture.Prop[CV_CAP_PROP_FRAME_WIDTH] := cR.cWidth; + FCapture.Prop[CV_CAP_PROP_FRAME_HEIGHT] := cR.cHeight; {$ELSE} - cvSetCaptureProperty(FCapture, CV_CAP_PROP_FRAME_WIDTH, CameraResolution[FResolution].cWidth); - cvSetCaptureProperty(FCapture, CV_CAP_PROP_FRAME_HEIGHT, CameraResolution[FResolution].cHeight); + cvSetCaptureProperty(FCapture, CV_CAP_PROP_FRAME_WIDTH, cR.cWidth); + cvSetCaptureProperty(FCapture, CV_CAP_PROP_FRAME_HEIGHT, cR.cHeight); {$ENDIF} end; diff --git a/source/component/ocv.comp.Types.pas b/source/component/ocv.comp.Types.pas index fb06023..745befd 100644 --- a/source/component/ocv.comp.Types.pas +++ b/source/component/ocv.comp.Types.pas @@ -414,7 +414,7 @@ const /// {$I haarcascade.inc} {$R haarcascade.res haarcascade.rc} -{.$R haarcascade.res} +{$R haarcascade.res} implementation diff --git a/source/ocv.core.types_c.pas b/source/ocv.core.types_c.pas index ba44d84..f988930 100644 --- a/source/ocv.core.types_c.pas +++ b/source/ocv.core.types_c.pas @@ -52,6 +52,14 @@ unit ocv.core.types_c; interface +Uses +{$IFDEF HAS_UNITSCOPE} + Winapi.Windows +{$ELSE} + Windows +{$ENDIF} + ; + const // Наименьшее число для которого выполняется условие 1.0+DBL_EPSILON <> 1.0 DBL_EPSILON = 2.2204460492503131E-016; @@ -66,7 +74,7 @@ type size_t = NativeUInt; pFloat = ^Float; ppFloat = ^pFloat; - pPointer = System.PPointer;//^Pointer; + pPointer = System.pPointer; // ^Pointer; ppvoid = pPointer; TSingleArray1D = array [0 .. 1] of Single; @@ -78,7 +86,7 @@ type TCVChar = CVChar; pCVChar = pAnsiChar; TpCVCharArray = array [0 .. 0] of pCVChar; - ppCVChar = ^TpCVCharArray; + ppCVChar = ^TpCVCharArray; // {$IFNDEF WIN64} // size_t = UInt32; // {$ELSE} @@ -1636,7 +1644,8 @@ 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; @@ -2273,7 +2282,8 @@ 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} @@ -2428,7 +2438,8 @@ end; function CV_ELEM_SIZE; 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; @@ -2748,8 +2759,8 @@ 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 := {$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}