zhaoyadi 2 年之前
当前提交
a55523f8e1

二进制
.vs/OpenCVDetect/FileContentIndex/4579e54f-274c-4bb5-9212-c62bb60e85a6.vsidx


二进制
.vs/OpenCVDetect/FileContentIndex/6586f09f-becc-40a8-8897-34966a793ba4.vsidx


二进制
.vs/OpenCVDetect/FileContentIndex/86dc325f-ed1d-4cbd-a25e-1fc0ae7dc5c5.vsidx


+ 0 - 0
.vs/OpenCVDetect/FileContentIndex/read.lock


二进制
.vs/OpenCVDetect/v17/.suo


二进制
.vs/OpenCVDetect/v17/Browse.VC.db


二进制
.vs/OpenCVDetect/v17/ipch/AutoPCH/8ec6e121cb2885c7/OPENCVDETECT.ipch


+ 31 - 0
OpenCVDetect.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33110.190
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenCVDetect", "OpenCVDetect\OpenCVDetect.vcxproj", "{DA0BC610-9F31-4F0F-B9E2-5A3D3FCFC0EF}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{DA0BC610-9F31-4F0F-B9E2-5A3D3FCFC0EF}.Debug|x64.ActiveCfg = Debug|x64
+		{DA0BC610-9F31-4F0F-B9E2-5A3D3FCFC0EF}.Debug|x64.Build.0 = Debug|x64
+		{DA0BC610-9F31-4F0F-B9E2-5A3D3FCFC0EF}.Debug|x86.ActiveCfg = Debug|Win32
+		{DA0BC610-9F31-4F0F-B9E2-5A3D3FCFC0EF}.Debug|x86.Build.0 = Debug|Win32
+		{DA0BC610-9F31-4F0F-B9E2-5A3D3FCFC0EF}.Release|x64.ActiveCfg = Release|x64
+		{DA0BC610-9F31-4F0F-B9E2-5A3D3FCFC0EF}.Release|x64.Build.0 = Release|x64
+		{DA0BC610-9F31-4F0F-B9E2-5A3D3FCFC0EF}.Release|x86.ActiveCfg = Release|Win32
+		{DA0BC610-9F31-4F0F-B9E2-5A3D3FCFC0EF}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {491DA48F-0FAB-4FFF-9D49-E56DE0026E96}
+	EndGlobalSection
+EndGlobal

+ 94 - 0
OpenCVDetect/OpenCVDetect.cpp

@@ -0,0 +1,94 @@
+#include <opencv2/opencv.hpp>
+#include <opencv2/xfeatures2d.hpp>
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <filesystem>
+
+using namespace cv;
+using namespace cv::xfeatures2d;
+using namespace std;
+using namespace std::filesystem;
+
+const auto detector = SIFT::create();
+/// <summary>
+/// 提取图片特征描述符
+/// </summary>
+/// <param name="image">待提取图片路径</param>
+/// <param name="output">保存描述符路径</param>
+void process_image(const path& image, const path& output) {
+	ofstream fs(output.string().c_str());
+	if (!fs.is_open()) {
+		cout << "create file error!";
+	}
+	fs.close();
+
+	Mat input_image = imread(image.string());
+
+	vector<KeyPoint> keypoints_cat;
+
+	Mat descriptor_cat, descriptor_smallCat;
+	detector->detectAndCompute(input_image, Mat(), keypoints_cat, descriptor_cat);
+
+	Mat convert;
+
+	if (descriptor_cat.type() != CV_32F)
+	{
+		descriptor_cat.convertTo(convert, CV_32F, 1.0 / 255, 0);
+	}
+	else
+	{
+		convert = descriptor_cat;
+	}
+
+	imwrite(output.string(), convert);
+}
+
+void deep_copy(const path& src, const path& des) {
+	if (is_regular_file(src)) {
+		auto d = des.string().substr(0, des.string().size() - 3) + "png\0";
+
+		process_image(src, path(d));
+		return;
+	}
+
+	if (!exists(des)) {
+		create_directories(des);
+	}
+
+	for (auto& it : directory_iterator(src)) {
+		string current = it.path().lexically_relative(it.path().parent_path()).string();
+		path des_next(des);
+		deep_copy(it.path(), des_next /= current);
+	}
+}
+
+int main(int argc, char** argv) {
+	string input_dir = "D:\\Work\\Cards";
+	//string output_dir = "D:\\Work\\Outputs";
+	string output_dir = "D:\\Work\\SIFT";
+
+	path input_dir_path(input_dir.c_str());
+	path output_dir_path(output_dir.c_str());
+
+	if (!exists(input_dir_path)) {
+		cout << "请设置正确的卡片存放路径" << endl;
+	}
+
+	if (exists(output_dir_path)) {
+		remove_all(output_dir_path);
+	}
+	else {
+		create_directories(output_dir_path);
+	}
+
+	directory_entry input_entry(input_dir_path);
+
+	assert(input_entry.status().type() == file_type::directory);
+
+	copy(input_dir_path, output_dir_path);
+
+	deep_copy(input_dir_path, output_dir_path);
+
+	return 0;
+}

+ 142 - 0
OpenCVDetect/OpenCVDetect.vcxproj

@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{da0bc610-9f31-4f0f-b9e2-5a3d3fcfc0ef}</ProjectGuid>
+    <RootNamespace>OpenCVDetect</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <IncludePath>D:\Code\build\install\include\opencv2;D:\Code\build\install\include;$(IncludePath)</IncludePath>
+    <LibraryPath>D:\Code\build\install\x64\vc17\lib;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <LanguageStandard_C>stdc17</LanguageStandard_C>
+      <LanguageStandard>stdcpp17</LanguageStandard>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>opencv_aruco460d.lib;opencv_barcode460d.lib;opencv_bgsegm460d.lib;opencv_bioinspired460d.lib;opencv_calib3d460d.lib;opencv_ccalib460d.lib;opencv_core460d.lib;opencv_datasets460d.lib;opencv_dnn460d.lib;opencv_dnn_objdetect460d.lib;opencv_dnn_superres460d.lib;opencv_dpm460d.lib;opencv_face460d.lib;opencv_features2d460d.lib;opencv_flann460d.lib;opencv_fuzzy460d.lib;opencv_gapi460d.lib;opencv_hfs460d.lib;opencv_highgui460d.lib;opencv_imgcodecs460d.lib;opencv_imgproc460d.lib;opencv_img_hash460d.lib;opencv_intensity_transform460d.lib;opencv_line_descriptor460d.lib;opencv_mcc460d.lib;opencv_ml460d.lib;opencv_objdetect460d.lib;opencv_optflow460d.lib;opencv_phase_unwrapping460d.lib;opencv_photo460d.lib;opencv_plot460d.lib;opencv_quality460d.lib;opencv_rapid460d.lib;opencv_reg460d.lib;opencv_rgbd460d.lib;opencv_saliency460d.lib;opencv_shape460d.lib;opencv_stereo460d.lib;opencv_stitching460d.lib;opencv_structured_light460d.lib;opencv_superres460d.lib;opencv_surface_matching460d.lib;opencv_text460d.lib;opencv_tracking460d.lib;opencv_video460d.lib;opencv_videoio460d.lib;opencv_videostab460d.lib;opencv_wechat_qrcode460d.lib;opencv_xfeatures2d460d.lib;opencv_ximgproc460d.lib;opencv_xobjdetect460d.lib;opencv_xphoto460d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="OpenCVDetect.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 22 - 0
OpenCVDetect/OpenCVDetect.vcxproj.filters

@@ -0,0 +1,22 @@
+<?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;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="头文件">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;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>
+    <ClCompile Include="OpenCVDetect.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>

+ 4 - 0
OpenCVDetect/OpenCVDetect.vcxproj.user

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

+ 13 - 0
OpenCVDetect/x64/Debug/OpenCVDetect.Build.CppClean.log

@@ -0,0 +1,13 @@
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\vc143.pdb
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\vc143.idb
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\opencvdetect.obj
+d:\project\cppporjects\opencvdetect\x64\debug\opencvdetect.exe
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\opencvdetect.ilk
+d:\project\cppporjects\opencvdetect\x64\debug\opencvdetect.pdb
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\opencvdetect.obj.enc
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\opencvdetect.tlog\cl.command.1.tlog
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\opencvdetect.tlog\cl.read.1.tlog
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\opencvdetect.tlog\cl.write.1.tlog
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\opencvdetect.tlog\link.command.1.tlog
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\opencvdetect.tlog\link.read.1.tlog
+d:\project\cppporjects\opencvdetect\opencvdetect\x64\debug\opencvdetect.tlog\link.write.1.tlog

+ 11 - 0
OpenCVDetect/x64/Debug/OpenCVDetect.exe.recipe

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+  <ProjectOutputs>
+    <ProjectOutput>
+      <FullPath>D:\Project\CppPorjects\OpenCVDetect\x64\Debug\OpenCVDetect.exe</FullPath>
+    </ProjectOutput>
+  </ProjectOutputs>
+  <ContentFiles />
+  <SatelliteDlls />
+  <NonRecipeFileRefs />
+</Project>

+ 1 - 0
OpenCVDetect/x64/Debug/OpenCVDetect.log

@@ -0,0 +1 @@
+

+ 0 - 0
OpenCVDetect/x64/Debug/OpenCVDetect.vcxproj.FileListAbsolute.txt