Signed-off-by: Laentir Valetov <laex@bk.ru>
This commit is contained in:
Laentir Valetov 2019-03-04 17:29:54 +04:00
parent e8c84f9a6d
commit bf6d45180f
8 changed files with 46 additions and 21 deletions

2
.gitignore vendored
View File

@ -17,7 +17,7 @@ CVAutoInstaller/
#Files
*.exe
!CheckCVDep.exe
!/CheckCVDep/CheckCVDep.exe
#*.dll
*.ini
*.bsc

Binary file not shown.

View File

@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{9F27EBDE-3B7A-4B88-8E68-90DCA8A35F81}</ProjectGuid>
<ProjectVersion>18.2</ProjectVersion>
<ProjectVersion>18.6</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<MainSource>cCameraCapture.dpr</MainSource>
<Base>True</Base>
@ -192,7 +192,7 @@
<Excluded_Packages Name="$(BDSBIN)\dclofficexp200.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment Version="2"/>
<Deployment Version="3"/>
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</Platform>

View File

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

View File

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

View File

@ -414,7 +414,7 @@ const
///
{$I haarcascade.inc}
{$R haarcascade.res haarcascade.rc}
{.$R haarcascade.res}
{$R haarcascade.res}
implementation

View File

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