This commit is contained in:
Laentir Valetov 2015-11-17 02:35:07 +03:00
parent e08b55d9d3
commit 3eee4a209c
12 changed files with 1567 additions and 1228 deletions

View File

@ -1,8 +1,8 @@
{$IFNDEF OPENCV_INC}
{$DEFINE OPENCV_INC}
{.$DEFINE DelphiOCVVersion_29}
{$DEFINE DelphiOCVVersion_30}
{$DEFINE DelphiOCVVersion_29}
{.$DEFINE DelphiOCVVersion_30}
{$IF DEFINED(DelphiOCVVersion_29) and DEFINED(DelphiOCVVersion_30)}
Error!!

View File

@ -158,6 +158,7 @@
<Source Name="MainSource">dclCommonOpenCV230.dpk</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl\dcldxPSDBTeeChartRS21.bpl">ExpressPrinting System ReportLink for DBTeeChart by Developer Express Inc.</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k230.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>

View File

@ -172,12 +172,6 @@
</Source>
</Delphi.Personality>
<Deployment Version="2">
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl\dclFFMSource230.bpl" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>dclFFMSource230.bpl</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
@ -198,16 +192,13 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="DependencyModule">
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl\dclFFMSource230.bpl" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
<RemoteName>dclFFMSource230.bpl</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
</DeployFile>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
@ -521,7 +512,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>

View File

@ -247,16 +247,7 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
@ -570,7 +561,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>

View File

@ -169,28 +169,19 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\15.0\Bpl\dclVCLOpenCV230.bpl" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>dclVCLOpenCV230.bpl</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl\dclVCLOpenCV230.bpl" Configuration="Release" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>dclVCLOpenCV230.bpl</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="DependencyModule">
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\15.0\Bpl\dclVCLOpenCV230.bpl" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
<RemoteName>dclVCLOpenCV230.bpl</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
</DeployFile>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
@ -504,7 +495,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>

View File

@ -93,6 +93,8 @@
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
@ -131,8 +133,8 @@
<Source Name="MainSource">ocvOpenCV230.dpk</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k210.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp210.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl\dcldxPSDBTeeChartRS21.bpl">ExpressPrinting System ReportLink for DBTeeChart by Developer Express Inc.</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k230.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
@ -148,16 +150,7 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
@ -471,7 +464,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>

View File

@ -21,8 +21,9 @@
// rights and limitations under the License.
// *******************************************************************
{$IFNDEF CLR}
{$I OpenCV.inc}
{$IFNDEF CLR}
unit ocv.comp.IOProperties;
{$ENDIF}

View File

@ -42,7 +42,6 @@ uses
{$ENDIF}
ocv.core.types_c,
ocv.highgui_c,
ocv.Classes,
ocv.comp.Types;
type

View File

@ -1,252 +0,0 @@
(*
**************************************************************************************************
Project Delphi-OpenCV
**************************************************************************************************
Contributor:
Laentir Valetov
email:laex@bk.ru
Mikhail Grigorev
email:sleuthound@gmail.com
**************************************************************************************************
You may retrieve the latest version of this file at the GitHub,
located at git://github.com/Laex/Delphi-OpenCV.git
**************************************************************************************************
License:
The contents of this file are 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/
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.
Alternatively, the contents of this file may be used under the terms of the
GNU Lesser General Public License (the "LGPL License"), in which case the
provisions of the LGPL License are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms
of the LGPL License and not to allow others to use your version of this file
under the MPL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the LGPL
License. If you do not delete the provisions above, a recipient may use
your version of this file under either the MPL or the LGPL License.
For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
**************************************************************************************************
Warning: Using Delphi XE3 syntax!
**************************************************************************************************
The Initial Developer of the Original Code:
OpenCV: open source computer vision library
Homepage: http://ocv.org
Online docs: http://docs.ocv.org
Q&A forum: http://answers.ocv.org
Dev zone: http://code.ocv.org
**************************************************************************************************
Original file:
opencv\modules\highgui\include\opencv2\highgui.hpp
*************************************************************************************************
*)
unit ocv.highgui;
{$I OpenCV.inc}
interface
uses
//{$IFDEF MSWINDOWS}
// Winapi.Windows,
//{$ENDIF MSWINDOWS}
ocv.mat,
ocv.core.types_c,
ocv.highgui_c;
type
// Attention!
// The sequence of function declarations interface must match the
// sequence of function declarations in the project "opencv_classes" (C++)
TccvVideoCapture = class
function open(device: Integer): boolean; overload; virtual; stdcall; abstract;
function openfile(filename: pAnsiChar): boolean; overload; virtual; stdcall; abstract;
function isOpened(): boolean; virtual; stdcall; abstract;
procedure release(); virtual; stdcall; abstract;
function grab(): boolean; virtual; stdcall; abstract;
function retrieve(Var image: TccvMat; flag: Integer): boolean; virtual; stdcall; abstract;
function read(Var image: TccvMat): boolean; virtual; stdcall; abstract;
function setValue(propId: Integer; value: double): boolean; virtual; stdcall; abstract;
function getValue(propId: Integer): double; virtual; stdcall; abstract;
// ---------------------------
class function Create: TccvVideoCapture; overload;
class function Create(device: Integer): TccvVideoCapture; overload;
class function Create(filename: pAnsiChar): TccvVideoCapture; overload;
procedure Free; reintroduce;
end;
// Flags for namedWindow
const
WINDOW_NORMAL = $00000000;
// the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size
WINDOW_AUTOSIZE = $00000001; // the user cannot resize the window, the size is constrainted by the image displayed
WINDOW_OPENGL = $00001000; // window with opengl support
WINDOW_FULLSCREEN = 1; // change the window to fullscreen
WINDOW_FREERATIO = $00000100; // the image expends as much as it can (no ratio constraint)
WINDOW_KEEPRATIO = $00000000; // the ratio of the image is respected
// CV_EXPORTS_W void namedWindow(const String& winname, int flags = WINDOW_AUTOSIZE);
procedure namedWindow(const winname: String; const flags: Integer = WINDOW_AUTOSIZE);
// CV_EXPORTS_W void destroyWindow(const String& winname);
procedure destroyWindow(const winname: String);
// CV_EXPORTS_W void destroyAllWindows();
procedure destroyAllWindows();
// CV_EXPORTS_W int startWindowThread();
function startWindowThread(): Integer;
// CV_EXPORTS_W int waitKey(int delay = 0);
function waitKey(const delay: Integer = 0): Integer;
// CV_EXPORTS_W void imshow(const String& winname, InputArray mat);
procedure imshow(const winname: String; const mat: TccvMat);
// CV_EXPORTS_W void resizeWindow(const String& winname, int width, int height);
procedure resizeWindow(const winname: String; const width, height: Integer);
// CV_EXPORTS_W void moveWindow(const String& winname, int x, int y);
procedure moveWindow(const winname: String; const x, y: Integer);
// CV_EXPORTS_W void setWindowProperty(const String& winname, int prop_id, double prop_value);
procedure setWindowProperty(const winname: String; const prop_id: Integer; const prop_value: double);
// CV_EXPORTS_W double getWindowProperty(const String& winname, int prop_id);
function getWindowProperty(const winname: String; const prop_id: Integer): double;
// CV_EXPORTS int createTrackbar(const String& trackbarname, const String& winname,
// int* value, int count,
// TrackbarCallback onChange = 0,
// void* userdata = 0);
function createTrackbar(const trackbarname: String; const winname: String; value: PInteger; count: Integer;
onChange: CvTrackbarCallback2 = nil; userdata: Pointer = nil): Integer;
// CV_EXPORTS_W Mat imread( const string& filename, int flags=1 );
function imread(const filename: string; flag: Integer = 1): TccvMat;
// CV_EXPORTS_W boolean imwrite( const string& filename, InputArray img, const vector<int>& params=vector<int>());
// function imwrite(const filename: String; const img: TccvMat): boolean;
type
TIplImageRecordHelper = record helper for TIplImage
function InitFromMat(const mat: TccvMat): TIplImage;
end;
implementation
uses
ocv.lib,
ocv.utils,
ocv.core_c;
function CreateVideoCapture: TccvVideoCapture; stdcall; external opencv_classes_lib name 'CreateVideoCapture'; overload;
function CreateVideoCapture(device: Integer): TccvVideoCapture; stdcall;
external opencv_classes_lib name 'CreateVideoCaptureDevice'; overload;
function CreateVideoCapture(filename: pAnsiChar): TccvVideoCapture; stdcall;
external opencv_classes_lib name 'CreateVideoCaptureFileName'; overload;
procedure ReleaseVideoCapture(ex: TccvVideoCapture); stdcall; external opencv_classes_lib;
// function _imread(const filename: pCvChar; flag: Integer): TccvMat; external opencv_classes_lib name '_imread';
// function _imwrite(const filename: pCvChar; const img: TccvMat): boolean; external opencv_classes_lib name '_imwrite';
function imread(const filename: string; flag: Integer): TccvMat;
begin
// Result := _imread(c_str(filename), flag);
Result := TccvMat.Create(cvLoadImage(pAnsiChar(AnsiString(filename)), flag));
end;
// function imwrite(const filename: String; const img: TccvMat): boolean;
// begin
// Result := _imwrite(c_str(filename), img);
// end;
procedure namedWindow(const winname: String; const flags: Integer = WINDOW_AUTOSIZE);
begin
cvNamedWindow(c_str(winname), flags);
end;
procedure destroyWindow(const winname: String);
begin
cvDestroyWindow(c_str(winname));
end;
procedure destroyAllWindows();
begin
cvDestroyAllWindows();
end;
function startWindowThread(): Integer;
begin
Result := cvStartWindowThread();
end;
function waitKey(const delay: Integer = 0): Integer;
begin
Result := cvWaitKey(delay);
end;
procedure imshow(const winname: String; const mat: TccvMat);
Var
IplImage: TIplImage;
begin
IplImage.InitFromMat(mat);
cvShowImage(c_str(winname), @IplImage);
end;
procedure resizeWindow(const winname: String; const width, height: Integer);
begin
cvResizeWindow(c_str(winname), width, height);
end;
procedure moveWindow(const winname: String; const x, y: Integer);
begin
cvMoveWindow(c_str(winname), x, y);
end;
procedure setWindowProperty(const winname: String; const prop_id: Integer; const prop_value: double);
begin
cvSetWindowProperty(c_str(winname), prop_id, prop_value);
end;
function getWindowProperty(const winname: String; const prop_id: Integer): double;
begin
Result := cvGetWindowProperty(c_str(winname), prop_id);
end;
function createTrackbar(const trackbarname: String; const winname: String; value: PInteger; count: Integer;
onChange: CvTrackbarCallback2 = nil; userdata: Pointer = nil): Integer;
begin
Result := cvCreateTrackbar2(c_str(trackbarname), c_str(winname), value, count, onChange, userdata);
end;
{ TIplImageRecordHelper }
function TIplImageRecordHelper.InitFromMat(const mat: TccvMat): TIplImage;
begin
Assert(mat.dims <= 2);
cvInitImageHeader(@Self, CvSize(mat.cols, mat.rows), cvIplDepth(mat.flags), mat.channels);
cvSetData(@Self, mat.data, mat.step1);
end;
{ TocvVideoCapture }
class function TccvVideoCapture.Create: TccvVideoCapture;
begin
Result := CreateVideoCapture;
end;
class function TccvVideoCapture.Create(device: Integer): TccvVideoCapture;
begin
Result := CreateVideoCapture(device);
end;
class function TccvVideoCapture.Create(filename: pAnsiChar): TccvVideoCapture;
begin
Result := CreateVideoCapture(filename);
end;
procedure TccvVideoCapture.Free;
begin
ReleaseVideoCapture(Self);
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -389,6 +389,21 @@
{$DEFINE HAS_TYPES}
{$ENDIF VER270}
{$IFDEF VER300} { Delphi 10 }
{$DEFINE Delphi}
{$DEFINE Delphi32}
{$DEFINE Delphi4UP}
{$DEFINE Delphi5UP}
{$DEFINE Delphi6UP}
{$DEFINE Delphi7UP}
{$DEFINE Delphi8UP}
{$DEFINE Delphi9UP}
{$DEFINE Delphi10UP}
{$WARN UNSAFE_TYPE OFF} {Disable warning for unsafe types in Delphi 7}
{$DEFINE Has_Int64}
{$DEFINE HAS_TYPES}
{$ENDIF VER300}
{$IFDEF UNIX}
{$ifdef VER140} // Kylix 1 & 2
{$DEFINE KYLIX}

View File

@ -696,7 +696,7 @@ BEGIN
A := ORD (Source [I]);
IF A < $80 THEN BEGIN // Range $0000..$007F
INC (Len);
Result [Len] := Source [I];
Result [Len] := AnsiChar(Source [I]);
INC (I);
END
ELSE BEGIN // Determine U, Inc I
@ -726,7 +726,7 @@ BEGIN
BREAK;
END;
INC (Len);
Result [Len] := Ch;
Result [Len] := AnsiChar(Ch);
END;
END;
SetLength (Result, Len);