mirror of
https://github.com/Laex/Delphi-OpenCV.git
synced 2024-11-15 15:55:53 +01:00
Fixed support Delphi XE
Signed-off-by: Mikhail Grigorev <sleuthhound@gmail.com>
This commit is contained in:
parent
2bc22e4527
commit
bb757c4a62
@ -1022,7 +1022,11 @@ uses
|
||||
ocv.core_c,
|
||||
ocv.imgproc_c,
|
||||
ocv.cvutils,
|
||||
{$IFDEF VER16P}
|
||||
System.Math;
|
||||
{$ELSE}
|
||||
Math;
|
||||
{$ENDIF VER16P}
|
||||
|
||||
// {$IFNDEF haarcascadeinc}
|
||||
// {$DEFINE haarcascadeinc}
|
||||
@ -2596,7 +2600,11 @@ end;
|
||||
|
||||
function TocvCropOperation.DoTransform(const Source: IocvImage; out Destanation: IocvImage): Boolean;
|
||||
begin
|
||||
{$IFDEF VER16P}
|
||||
if FCropRect.ocvRect.IsEmpty then
|
||||
{$ELSE}
|
||||
if IsRectEmpty(FCropRect.ocvRect) then
|
||||
{$ENDIF}
|
||||
Destanation := Source
|
||||
else
|
||||
Destanation := Source.Crop(FCropRect.cvRect);
|
||||
|
@ -19,13 +19,22 @@ function ocvHaarCascadeTransform(
|
||||
|
||||
function ocvLoadHaarCascade(const HaarCascadeType: TocvHaarCascadeType): pCvHaarClassifierCascade;
|
||||
|
||||
function IsRectEmpty(const Rect: TocvRect): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
Uses
|
||||
{$IFDEF VER16P}
|
||||
WinApi.Windows,
|
||||
System.SysUtils,
|
||||
System.Classes,
|
||||
System.ZLib,
|
||||
{$ELSE}
|
||||
Windows,
|
||||
SysUtils,
|
||||
Classes,
|
||||
ZLib,
|
||||
{$ENDIF VER16P}
|
||||
ocv.core_c,
|
||||
ocv.imgproc_c,
|
||||
ocv.cvutils;
|
||||
@ -118,4 +127,9 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function IsRectEmpty(const Rect: TocvRect): Boolean;
|
||||
begin
|
||||
Result := (Rect.Right <= Rect.Left) or (Rect.Bottom <= Rect.Top);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -355,7 +355,7 @@ uses
|
||||
|
||||
function cvRect(const oRect: TocvRect): TcvRect;
|
||||
begin
|
||||
Result := ocv.core.types_c.cvRect(oRect.Left, oRect.Top, oRect.Width, oRect.Height);
|
||||
Result := ocv.core.types_c.cvRect(oRect.Left, oRect.Top, {$IFDEF VER16P}oRect.Width{$ELSE}oRect.Right-oRect.Left{$ENDIF}, {$IFDEF VER16P}oRect.Height{$ELSE}oRect.Bottom-oRect.Top{$ENDIF});
|
||||
end;
|
||||
|
||||
function HaarSetToFlag(const CascadeFlags: TocvHaarCascadeFlagSet): Integer;
|
||||
@ -738,7 +738,7 @@ procedure TocvCanvas.Ellipse(const CenterX, CenterY: Integer; const Axes: TocvRe
|
||||
const Color: TColor; const Thickness: Integer; const LineType: TocvLineType; const Shift: Integer);
|
||||
begin
|
||||
if Assigned(FOwner) and Assigned(FOwner.FImage) then
|
||||
cvEllipse(FOwner.FImage, cvPoint(CenterX, CenterY), cvSize(Axes.Width, Axes.Height), Angle, start_angle, nd_angle, ColorToCvRGB(Color),
|
||||
cvEllipse(FOwner.FImage, cvPoint(CenterX, CenterY), cvSize({$IFDEF VER16P}Axes.Width{$ELSE}Axes.Right-Axes.Left{$ENDIF}, {$IFDEF VER16P}Axes.Height{$ELSE}Axes.Bottom-Axes.Top{$ENDIF}), Angle, start_angle, nd_angle, ColorToCvRGB(Color),
|
||||
Thickness, cLineType[LineType], Shift);
|
||||
end;
|
||||
|
||||
@ -763,7 +763,7 @@ end;
|
||||
procedure TocvCanvas.EllipseBox(const Box: TocvRect; const Angle: Single; const Color: TColor; const Thickness: Integer;
|
||||
const LineType: TocvLineType; const Shift: Integer);
|
||||
begin
|
||||
EllipseBox(CvBox2D(Box.Left, Box.Top, Box.Width, Box.Height, Angle), Color, Thickness, LineType, Shift);
|
||||
EllipseBox(CvBox2D(Box.Left, Box.Top, {$IFDEF VER16P}Box.Width{$ELSE}Box.Right-Box.Left{$ENDIF}, {$IFDEF VER16P}Box.Height{$ELSE}Box.Bottom-Box.Top{$ENDIF}, Angle), Color, Thickness, LineType, Shift);
|
||||
end;
|
||||
|
||||
procedure TocvCanvas.Rectangle(const x1, y1, x2, y2: Integer; const Color: TColor; const Thickness: Integer; const LineType: TocvLineType;
|
||||
@ -887,8 +887,8 @@ Var
|
||||
begin
|
||||
Result.x := Left;
|
||||
Result.y := Top;
|
||||
Result.Width := Width;
|
||||
Result.Height := Height;
|
||||
Result.Width := {$IFDEF VER16P}Width{$ELSE}Right-Left{$ENDIF};
|
||||
Result.Height := {$IFDEF VER16P}Height{$ELSE}Bottom-Top{$ENDIF};
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -1,10 +1,18 @@
|
||||
{$IFNDEF CLR}
|
||||
{$I Opencv.inc}
|
||||
unit ocv.comp.VideoWriter;
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
Uses
|
||||
{$IFDEF VER16P}
|
||||
System.SysUtils,
|
||||
System.Classes,
|
||||
{$ELSE}
|
||||
SysUtils,
|
||||
Classes,
|
||||
{$ENDIF VER16P}
|
||||
ocv.highgui_c,
|
||||
ocv.core_c,
|
||||
ocv.core.types_c,
|
||||
|
@ -409,7 +409,7 @@ begin
|
||||
SetStretchBltMode(dc, COLORONCOLOR);
|
||||
SetMapMode(dc, MM_TEXT);
|
||||
// Stretch the image to fit the rectangle
|
||||
iResult := StretchDIBits(dc, rect.left, rect.top, rect.Width, rect.Height, 0, 0, img^.Width, img^.Height, img^.ImageData, _dibhdr,
|
||||
iResult := StretchDIBits(dc, rect.left, rect.top, {$IFDEF VER16P}rect.Width{$ELSE}rect.Right-rect.Left{$ENDIF}, {$IFDEF VER16P}rect.Height{$ELSE}rect.Bottom-rect.Top{$ENDIF}, 0, 0, img^.Width, img^.Height, img^.ImageData, _dibhdr,
|
||||
DIB_RGB_COLORS, SRCCOPY);
|
||||
Result := (iResult > 0); // and (iResult <> GDI_ERROR);
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user