GridAdaptiveFeatureDetector in Features2D

Signed-off-by: Laentir Valetov <laex@bk.ru>
This commit is contained in:
Laentir Valetov 2016-09-11 21:14:52 +04:00
parent 91e285b316
commit b8de486aae
15 changed files with 1070 additions and 59 deletions

3
.gitignore vendored
View File

@ -46,3 +46,6 @@ lib
*.iobj
*.ipdb
*.db
*.user
*.filters
*.user

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,46 @@
program FeatureDetector;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
ocv.core.types_c,
ocv.highgui_c,
ocv.imgproc.types_c,
ocv.imgproc_c,
ocv.lib,
uResourcePaths,
ocv.cls.contrib,
ocv.cls.core,
ocv.cls.highgui,
ocv.cls.objdetect,
ocv.cls.types,
ocv.cls.features2d;
Var
P: TFeatureDetector;
D: TDescriptorExtractor;
i: pIplImage;
keypoints: TKeyPointArray;
M: TMat;
begin
try
Writeln('Loadimage ',cResourceMedia + 'box.png');
i := cvLoadImage(cResourceMedia + 'box.png', CV_LOAD_IMAGE_GRAYSCALE);
Writeln('Use feature detector ',cfdGridFAST);
P := TFeatureDetector.Create(cfdGridFAST);
P.detect(i, keypoints, nil);
Writeln('Found ',Length(keypoints),' keypoint');
Writeln('Use descriptor extractor ',denSURF);
D := TDescriptorExtractor.Create(denSURF);
D.compute(i, keypoints, M);
Writeln('Found ',M.total,' descriptors');
Readln;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.

View File

@ -0,0 +1,635 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{9C741757-ECD2-449E-9A8D-8671534F79A7}</ProjectGuid>
<MainSource>FeatureDetector.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<TargetedPlatforms>3</TargetedPlatforms>
<AppType>Console</AppType>
<FrameworkType>VCL</FrameworkType>
<ProjectVersion>18.1</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
<Base_Android>true</Base_Android>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Base)'=='true') or '$(Base_iOSDevice32)'!=''">
<Base_iOSDevice32>true</Base_iOSDevice32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Base)'=='true') or '$(Base_iOSDevice64)'!=''">
<Base_iOSDevice64>true</Base_iOSDevice64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Base)'=='true') or '$(Base_iOSSimulator)'!=''">
<Base_iOSSimulator>true</Base_iOSSimulator>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
<Cfg_1_Win64>true</Cfg_1_Win64>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Cfg_2)'=='true') or '$(Cfg_2_iOSDevice32)'!=''">
<Cfg_2_iOSDevice32>true</Cfg_2_iOSDevice32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Cfg_2)'=='true') or '$(Cfg_2_iOSDevice64)'!=''">
<Cfg_2_iOSDevice64>true</Cfg_2_iOSDevice64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Cfg_2)'=='true') or '$(Cfg_2_iOSSimulator)'!=''">
<Cfg_2_iOSSimulator>true</Cfg_2_iOSSimulator>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
<Cfg_2_Win64>true</Cfg_2_Win64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
<Manifest_File>None</Manifest_File>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Winapi;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<DCC_S>false</DCC_S>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_K>false</DCC_K>
<VerInfo_Locale>1049</VerInfo_Locale>
<DCC_N>false</DCC_N>
<SanitizedProjectName>FeatureDetector</SanitizedProjectName>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
<AUP_CAMERA>true</AUP_CAMERA>
<AUP_ACCESS_COARSE_LOCATION>true</AUP_ACCESS_COARSE_LOCATION>
<Android_LauncherIcon36>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png</Android_LauncherIcon36>
<Android_LauncherIcon144>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png</Android_LauncherIcon144>
<AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE>
<Android_LauncherIcon48>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png</Android_LauncherIcon48>
<EnabledSysJars>android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
<Android_SplashImage470>$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png</Android_SplashImage470>
<AUP_READ_CALENDAR>true</AUP_READ_CALENDAR>
<Android_LauncherIcon96>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png</Android_LauncherIcon96>
<AUP_CALL_PHONE>true</AUP_CALL_PHONE>
<Android_SplashImage960>$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png</Android_SplashImage960>
<AUP_INTERNET>true</AUP_INTERNET>
<AUP_WRITE_CALENDAR>true</AUP_WRITE_CALENDAR>
<AUP_ACCESS_FINE_LOCATION>true</AUP_ACCESS_FINE_LOCATION>
<Android_LauncherIcon72>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png</Android_LauncherIcon72>
<Android_SplashImage426>$(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png</Android_SplashImage426>
<AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
<AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE>
<Android_SplashImage640>$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png</Android_SplashImage640>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSDevice32)'!=''">
<iPhone_Spotlight40>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png</iPhone_Spotlight40>
<VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily>
<iPad_Launch1024x768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png</iPad_Launch1024x768>
<iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152>
<iPad_SpotLight40>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png</iPad_SpotLight40>
<iPad_Launch768x1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png</iPad_Launch768x1024>
<iPad_Launch1536x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png</iPad_Launch1536x2048>
<iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80>
<iPad_Launch2048x1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png</iPad_Launch2048x1536>
<iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80>
<VerInfo_BundleId>$(MSBuildProjectName)</VerInfo_BundleId>
<iPad_AppIcon76>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png</iPad_AppIcon76>
<iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120>
<iPhone_AppIcon60>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png</iPhone_AppIcon60>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone &amp; iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=</VerInfo_Keys>
<BT_BuildType>Debug</BT_BuildType>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSDevice64)'!=''">
<iPhone_Spotlight40>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png</iPhone_Spotlight40>
<VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily>
<iPad_Launch1024x768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png</iPad_Launch1024x768>
<iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152>
<iPad_SpotLight40>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png</iPad_SpotLight40>
<iPad_Launch768x1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png</iPad_Launch768x1024>
<iPad_Launch1536x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png</iPad_Launch1536x2048>
<iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80>
<iPad_Launch2048x1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png</iPad_Launch2048x1536>
<iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80>
<VerInfo_BundleId>$(MSBuildProjectName)</VerInfo_BundleId>
<iPad_AppIcon76>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png</iPad_AppIcon76>
<iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120>
<iPhone_AppIcon60>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png</iPhone_AppIcon60>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone &amp; iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=</VerInfo_Keys>
<BT_BuildType>Debug</BT_BuildType>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSSimulator)'!=''">
<VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily>
<iPhone_Spotlight40>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png</iPhone_Spotlight40>
<iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152>
<iPad_Launch1536x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png</iPad_Launch1536x2048>
<iPad_Launch768x1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png</iPad_Launch768x1024>
<iPad_SpotLight40>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png</iPad_SpotLight40>
<iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80>
<iPad_Launch1024x768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png</iPad_Launch1024x768>
<iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80>
<iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120>
<iPad_AppIcon76>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png</iPad_AppIcon76>
<VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone &amp; iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=</VerInfo_Keys>
<iPad_Launch2048x1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png</iPad_Launch2048x1536>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<iPhone_AppIcon60>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png</iPhone_AppIcon60>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_ExeOutput>..\..\..\bin\win32\</DCC_ExeOutput>
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<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="'$(Base_Win64)'!=''">
<DCC_ExeOutput>..\..\..\bin\win64\</DCC_ExeOutput>
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
<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_1)'!=''">
<DCC_DebugInformation>0</DCC_DebugInformation>
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<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_1_Win64)'!=''">
<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)'!=''">
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_Optimize>false</DCC_Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_iOSDevice32)'!=''">
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_iOSDevice64)'!=''">
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_iOSSimulator)'!=''">
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<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>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<None Include="..\..\..\source\OpenCV.inc"/>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">FeatureDetector.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k240.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp240.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
<Platform value="Android">False</Platform>
<Platform value="iOSDevice32">False</Platform>
<Platform value="iOSDevice64">False</Platform>
<Platform value="iOSSimulator">False</Platform>
<Platform value="OSX32">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</Platform>
</Platforms>
<Deployment Version="3">
<DeployFile LocalName="..\..\..\source\OpenCV.inc" Configuration="Debug" Class="ProjectFile">
<Platform Name="Win32">
<RemoteDir>.\</RemoteDir>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="..\..\..\bin\win32\FeatureDetector.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>FeatureDetector.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="\FeatureDetector.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win64">
<RemoteName>FeatureDetector.exe</RemoteName>
<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="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClassesDexFile">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="Win32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch768">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
<Platform Name="Linux64">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
</Platform>
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeX86File"/>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1024">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch320">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSInfoPList"/>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1536">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640x1136">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSEntitlements"/>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXInfoPList"/>
<DeployClass Name="ProjectOSXEntitlements"/>
<DeployClass Name="iPad_Launch2048">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
</Deployment>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>

Binary file not shown.

View File

@ -35,8 +35,8 @@ Uses
ocv.cls.types;
Type
TInputArrayOfIplImage = TArray<pIplImage>; // InputArrayOfArrays
TInputArrayOfMat = TArray<IMat>; // InputArrayOfArrays
TInputArrayOfIplImage = TArrayOfpIplImage; // InputArrayOfArrays
TInputArrayOfMat = TArrayOfIMat; // InputArrayOfArrays
TInputArrayOfInteger = TArray<Integer>; // InputArray
IFaceRecognizer = interface(IOCVCommon)

View File

@ -98,11 +98,11 @@ type
{$IFDEF SAFELOADLIB}
type
TredirectError = function(errCallback: TErrorCallback; userdata: pointer = nil; prevUserdata: PPointer = nil)
TRedirectError = function(errCallback: TErrorCallback; userdata: pointer = nil; prevUserdata: PPointer = nil)
: TErrorCallback; cdecl;
var
redirectError: TredirectError;
redirectError: TRedirectError;
{$ELSE}
function redirectError(errCallback: TErrorCallback; userdata: pointer = nil; prevUserdata: PPointer = nil)
: TErrorCallback; cdecl;
@ -364,6 +364,9 @@ Type
function data(): pointer; // 11
end;
TArrayOfTMat = TArray<TMat>;
TArrayOfIMat = TArray<IMat>;
TIplImageRecordHelper = record helper for TIplImage
function InitFromMat(const Mat: IMat): TIplImage;
end;

View File

@ -0,0 +1,282 @@
(*
*****************************************************************
Delphi-OpenCV
Copyright (C) 2013 Project Delphi-OpenCV
****************************************************************
Contributor:
Laentir Valetov
email:laex@bk.ru
****************************************************************
You may retrieve the latest version of this file at the GitHub,
located at git://github.com/Laex/Delphi-OpenCV.git
****************************************************************
The contents of this file are used with permission, 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/MPL-1_1Final.html
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.
*******************************************************************
*)
unit ocv.cls.features2d;
{$I OpenCV.inc}
interface
Uses
ocv.cls.types,
ocv.cls.core,
ocv.core_c,
ocv.core.types_c;
type
TKeyPoint = record
pt: TcvPoint2f; // !< coordinates of the keypoints
size: Single; // !< diameter of the meaningful keypoint neighborhood
angle: Single; // !< computed orientation of the keypoint (-1 if not applicable);
// !< it's in [0,360) degrees and measured relative to
// !< image coordinate system, ie in clockwise.
response: Single; // !< the response by which the most strong keypoints have been selected. Can be used for the further sorting or subsampling
octave: Integer; // !< octave (pyramid layer) from which the keypoint has been extracted
class_id: Integer; // !< object class (if the keypoints need to be clustered by an object they belong to)
end;
pKeyPoint = ^TKeyPoint;
TKeyPointArray = TArray<TKeyPoint>;
TKeyPointArrayOfArray = TArray<TKeyPointArray>;
// ---------------------------- FeatureDetector --------------------------
const
// feature detector adapter name
fanGridAdapter = 'Grid'; // GridAdaptedFeatureDetector
fanPyramidAdapter = 'Pyramid'; // PyramidAdaptedFeatureDetector
fanDynamicAdapter = 'Dynamic';
// feature detector name
fdtFAST = 'FAST'; // FastFeatureDetector
fdtSTAR = 'STAR'; // StarFeatureDetector
fdtSIFT = 'SIFT'; // SIFT (nonfree module)
fdtSURF = 'SURF'; // SURF (nonfree module)
fdtORB = 'ORB'; // ORB
fdtBRISK = 'BRISK'; // BRISK
fdtMSER = 'MSER'; // MSER
fdtGFTT = 'GFTT'; // GoodFeaturesToTrackDetector
fdtHARRIS = 'HARRIS'; // GoodFeaturesToTrackDetector with Harris detector enabled
fdtDense = 'Dense'; // DenseFeatureDetector
fdtSimpleBlob = 'SimpleBlob'; // SimpleBlobDetector
// combined format "adapter name"+"detector name"
// for example: "GridFAST", "PyramidSTAR" .
cfdGridFAST = 'GridFAST';
cfdPyramidSTAR = 'PyramidSTAR';
Type
IFeatureDetector = interface(IOCVCommon)
['{1BA6C295-0C46-4C64-AB37-1073F969830C}']
procedure detect(const image: PIplImage; Var keypoints: TKeyPointArray; const mask: PIplImage); overload;
procedure detect(const images: TArrayofPIplImage; Var keypoints: TKeyPointArrayOfArray; masks: TArrayofPIplImage); overload;
function empty(): boolean;
end;
TFeatureDetector = class(TOCVCommon, IFeatureDetector)
public
(*
* Detect keypoints in an image.
* image The image.
* keypoints The detected keypoints.
* mask Mask specifying where to look for keypoints (optional). Must be a char
* matrix with non-zero values in the region of interest.
*)
// CV_WRAP void detect( const Mat& image, CV_OUT vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const;
procedure detect(const image: PIplImage; Var keypoints: TKeyPointArray; const mask: PIplImage); overload;
(*
* Detect keypoints in an image set.
* images Image collection.
* keypoints Collection of keypoints detected in an input images. keypoints[i] is a set of keypoints detected in an images[i].
* masks Masks for image set. masks[i] is a mask for images[i].
*)
// void detect( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints, const vector<Mat>& masks=vector<Mat>() ) const;
procedure detect(const images: TArrayofPIplImage; Var keypoints: TKeyPointArrayOfArray; masks: TArrayofPIplImage); overload;
// Return true if detector object is empty
// CV_WRAP virtual bool empty() const;
function empty(): boolean;
// Create feature detector by detector name.
constructor Create(const detectorType: String);
end;
// ---------------------------- DescriptorExtractor --------------------------
const
// extractor adapter name
eanOpponent = 'Opponent'; // OpponentColorDescriptorExtractor
// descriptor extractor name
denSIFT = 'SIFT'; // SIFT
denSURF = 'SURF'; // SURF
denBRIEF = 'BRIEF'; // BriefDescriptorExtractor
denBRISK = 'BRISK'; // BRISK
denORB = 'ORB'; // ORB
denFREAK = 'FREAK'; // FREAK
// A combined format is also supported:
// descriptor extractor adapter name ( "Opponent" OpponentColorDescriptorExtractor ) + descriptor extractor name,
// for example: "OpponentSIFT"
ceOpponentSIFT = 'OpponentSIFT';
Type
IDescriptorExtractor = interface(IOCVCommon)
['{E9FA5428-0592-487B-9003-EB36B1212050}']
procedure compute(const image: PIplImage; keypoints: TKeyPointArray; Var descriptors: TMat); overload;
procedure compute(const images: TArrayofPIplImage; keypoints: TKeyPointArrayOfArray; Var descriptors: TArrayOfTMat); overload;
function descriptorSize: Integer;
function descriptorType: Integer;
function empty: cbool;
end;
TDescriptorExtractor = class(TOCVCommon, IDescriptorExtractor)
public
(*
* Compute the descriptors for a set of keypoints in an image.
* image The image.
* keypoints The input keypoints. Keypoints for which a descriptor cannot be computed are removed.
* descriptors Copmputed descriptors. Row i is the descriptor for keypoint i.
*)
// CV_WRAP void compute( const Mat& image, CV_OUT CV_IN_OUT vector<KeyPoint>& keypoints, CV_OUT Mat& descriptors ) const;
procedure compute(const image: PIplImage; keypoints: TKeyPointArray; Var descriptors: TMat); overload;
(*
* Compute the descriptors for a keypoints collection detected in image collection.
* images Image collection.
* keypoints Input keypoints collection. keypoints[i] is keypoints detected in images[i].
* Keypoints for which a descriptor cannot be computed are removed.
* descriptors Descriptor collection. descriptors[i] are descriptors computed for set keypoints[i].
*)
// void compute( const vector<Mat>& images, vector<vector<KeyPoint> >& keypoints, vector<Mat>& descriptors ) const;
procedure compute(const images: TArrayofPIplImage; keypoints: TKeyPointArrayOfArray; Var descriptors: TArrayOfTMat); overload;
// CV_WRAP virtual int descriptorSize() const = 0;
function descriptorSize: Integer;
// CV_WRAP virtual int descriptorType() const = 0;
function descriptorType: Integer;
// CV_WRAP virtual bool empty() const;
function empty: cbool;
// CV_WRAP static Ptr<DescriptorExtractor> create( const string& descriptorExtractorType );
constructor Create(const descriptorExtractorType: String);
end;
implementation
uses
ocv.nonfree,
ocv.utils,
ocv.lib;
{ TFeatureDetector }
function Create_FeatureDetector(const detectorType: pAnsiChar): TOpenCVClass; stdcall; external opencv_classes_lib name '_Create_FeatureDetector@4';
function Empty_FeatureDetector(const F: TOpenCVClass): cbool; stdcall; external opencv_classes_lib name '_Empty_FeatureDetector@4';
procedure detect_FeatureDetector(const F: TOpenCVClass; image: PIplImage; Var keypointcount: Integer; Var keypoints: pKeyPoint; mask: PIplImage);
stdcall; external opencv_classes_lib name '_detect_FeatureDetector@20';
constructor TFeatureDetector.Create(const detectorType: String);
begin
inherited Create(Create_FeatureDetector(detectorType.AsPAnsiChar));
end;
procedure TFeatureDetector.detect(const image: PIplImage; Var keypoints: TKeyPointArray; const mask: PIplImage);
Var
kpcount: Integer;
kp: pKeyPoint;
i: Integer;
begin
detect_FeatureDetector(FData, image, kpcount, kp, mask);
SetLength(keypoints, kpcount);
for i := 0 to kpcount - 1 do
keypoints[i] := kp[i];
cvFree_(kp);
end;
procedure TFeatureDetector.detect(const images: TArrayofPIplImage; Var keypoints: TKeyPointArrayOfArray; masks: TArrayofPIplImage);
var
i: Integer;
begin
SetLength(keypoints, Length(images));
SetLength(masks, Length(images));
for i := 0 to High(images) do
detect(images[i], keypoints[i], masks[i]);
end;
function TFeatureDetector.empty: boolean;
begin
Result := Empty_FeatureDetector(FData);
end;
{ TDescriptorExtractor }
function Create_DescriptorExtractor(const descriptorExtractorType: pAnsiChar): TOpenCVClass; stdcall;
external opencv_classes_lib name '_Create_DescriptorExtractor@4';
function Empty_DescriptorExtractor(const F: TOpenCVClass): cbool; stdcall; external opencv_classes_lib name '_Empty_DescriptorExtractor@4';
procedure compute_DescriptorExtractor(const F: TOpenCVClass; image: PIplImage; keypointcount: Integer; keypoints: pKeyPoint; Var mask: TOpenCVClass);
stdcall; external opencv_classes_lib name '_compute_DescriptorExtractor@20';
function descriptorSize_DescriptorExtractor(const F: TOpenCVClass): Integer; stdcall;
external opencv_classes_lib name '_descriptorSize_DescriptorExtractor@4';
function descriptorType_DescriptorExtractor(const F: TOpenCVClass): Integer; stdcall;
external opencv_classes_lib name '_descriptorType_DescriptorExtractor@4';
procedure TDescriptorExtractor.compute(const image: PIplImage; keypoints: TKeyPointArray; Var descriptors: TMat);
Var
desc: TOpenCVClass;
begin
if Length(keypoints) > 0 then
begin
compute_DescriptorExtractor(FData, image, Length(keypoints), @keypoints[0], desc);
descriptors := TMat.Create(desc);
end
else
descriptors := TMat.Create;
end;
procedure TDescriptorExtractor.compute(const images: TArrayofPIplImage; keypoints: TKeyPointArrayOfArray; var descriptors: TArrayOfTMat);
var
i: Integer;
begin
SetLength(descriptors, Length(images));
for i := 0 to High(images) do
compute(images[i], keypoints[i], descriptors[i]);
end;
constructor TDescriptorExtractor.Create(const descriptorExtractorType: String);
begin
inherited Create(Create_DescriptorExtractor(descriptorExtractorType.AsPAnsiChar));
end;
function TDescriptorExtractor.descriptorSize: Integer;
begin
Result := descriptorSize_DescriptorExtractor(FData);
end;
function TDescriptorExtractor.descriptorType: Integer;
begin
Result := descriptorType_DescriptorExtractor(FData);
end;
function TDescriptorExtractor.empty: cbool;
begin
Result := Empty_DescriptorExtractor(FData);
end;
end.

View File

@ -319,6 +319,7 @@ type
pIplImage = ^TIplImage;
TpIplImageArray = array [0 .. 1] of pIplImage;
TArrayOfpIplImage = TArray<pIplImage>;
ppIplImage = ^TpIplImageArray;
pIplROI = ^TIplROI;
pIplTileInfo = ^TIplTileInfo;

View File

@ -0,0 +1,93 @@
#include "stdafx.h"
namespace cv
{
typedef struct
{
Point2f pt;
float size;
float angle;
float response;
int octave;
int class_id;
} _KeyPoint;
//////////////////// FeatureDetector ////////////////////
ICLASS_API FeatureDetector* __stdcall Create_FeatureDetector(const char* detectorType)
{
Ptr<FeatureDetector> r= FeatureDetector::create(detectorType);
r.addref();
return r;
}
ICLASS_API bool __stdcall Empty_FeatureDetector(const FeatureDetector* r)
{
return r->empty();
}
//std::vector<KeyPoint> kp;
std::vector<KeyPoint>* kp = new std::vector<KeyPoint>();
ICLASS_API void __stdcall detect_FeatureDetector(const FeatureDetector* r, IplImage* image,
CV_OUT int &keypointcount, CV_OUT _KeyPoint* &keypoints, IplImage* mask)
{
//std::vector<KeyPoint>* kp = new std::vector<KeyPoint>();
//kp.clear();
//kp = new std::vector<KeyPoint>();
r->detect(Mat(image), *kp, (mask ? Mat(mask) : Mat()));
keypointcount = kp->size();
if (kp->size())
{
keypoints = (_KeyPoint*)cvAlloc(sizeof(_KeyPoint)*kp->size());
// need memcpy
for (int i = 0; i < kp->size(); i++)
{
keypoints[i].pt = (*kp)[i].pt;
keypoints[i].angle = (*kp)[i].angle;
keypoints[i].class_id = (*kp)[i].class_id;
keypoints[i].octave = (*kp)[i].octave;
keypoints[i].response = (*kp)[i].response;
keypoints[i].size = (*kp)[i].size;
}
}
else keypoints = 0;
//delete kp;
}
//////////////////// DescriptorExtractor ////////////////////
ICLASS_API DescriptorExtractor* __stdcall Create_DescriptorExtractor(const char* descriptorExtractorType)
{
Ptr<DescriptorExtractor> r = DescriptorExtractor::create(descriptorExtractorType);
r.addref();
return r;
}
ICLASS_API bool __stdcall Empty_DescriptorExtractor(const DescriptorExtractor* r)
{
return r->empty();
}
ICLASS_API int __stdcall descriptorSize_DescriptorExtractor(const DescriptorExtractor* r)
{
return r->descriptorSize();
}
ICLASS_API int __stdcall descriptorType_DescriptorExtractor(const DescriptorExtractor* r)
{
return r->descriptorType();
}
ICLASS_API void __stdcall compute_DescriptorExtractor(const DescriptorExtractor* r, IplImage* image,
int keypointcount, _KeyPoint* keypoints, CV_OUT Mat* &descriptors)
{
std::vector<KeyPoint> kp;
for (size_t i = 0; i < keypointcount; i++) {
kp.push_back(
KeyPoint(
keypoints[i].pt, keypoints[i].size, keypoints[i].angle,
keypoints[i].response, keypoints[i].octave, keypoints[i].class_id
)
);
}
descriptors = new Mat;
r->compute(Mat(image), kp, *descriptors);
}
}

View File

@ -178,6 +178,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="features2d_prx.cpp" />
<ClCompile Include="objdetect_prx.cpp" />
<ClCompile Include="highgui_prx.cpp" />
<ClCompile Include="imgproc_prx.cpp" />

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Файлы исходного кода">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Заголовочные файлы">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Файлы ресурсов">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Заголовочные файлы</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
<ClCompile Include="contrib_prx.cpp">
<Filter>Файлы исходного кода</Filter>
</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>
<ClCompile Include="imgproc_prx.cpp">
<Filter>Файлы исходного кода</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@ -20,6 +20,8 @@
#include "opencv2/objdetect.hpp"
#include "opencv2/contrib/contrib.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
// TODO: Установите здесь ссылки на дополнительные заголовки, требующиеся для программы