WeChatOcrCpp ok
Browse files- imradv3.sln +10 -0
- src/Constant.cpp +1 -1
- src/Constant.h +1 -1
- src/WeChatOcrCpp/WeChatOcrCpp.vcxproj +2 -2
- src/WeChatOcrCpp/main.cpp +1 -1
- src/main.cpp +9 -6
imradv3.sln
CHANGED
|
@@ -13,6 +13,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nativefiledialog", "3rdpart
|
|
| 13 |
EndProject
|
| 14 |
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imgui", "3rdparty\imgui\imgui.vcxproj", "{08DE3CE9-D0C0-4426-AAA6-1ADA88494BE3}"
|
| 15 |
EndProject
|
|
|
|
|
|
|
| 16 |
Global
|
| 17 |
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
| 18 |
Debug|x64 = Debug|x64
|
|
@@ -61,6 +63,14 @@ Global
|
|
| 61 |
{08DE3CE9-D0C0-4426-AAA6-1ADA88494BE3}.Release|x64.Build.0 = Release|x64
|
| 62 |
{08DE3CE9-D0C0-4426-AAA6-1ADA88494BE3}.Release|x86.ActiveCfg = Release|Win32
|
| 63 |
{08DE3CE9-D0C0-4426-AAA6-1ADA88494BE3}.Release|x86.Build.0 = Release|Win32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
EndGlobalSection
|
| 65 |
GlobalSection(SolutionProperties) = preSolution
|
| 66 |
HideSolutionNode = FALSE
|
|
|
|
| 13 |
EndProject
|
| 14 |
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imgui", "3rdparty\imgui\imgui.vcxproj", "{08DE3CE9-D0C0-4426-AAA6-1ADA88494BE3}"
|
| 15 |
EndProject
|
| 16 |
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WeChatOcrCpp", "src\WeChatOcrCpp\WeChatOcrCpp.vcxproj", "{47E51CB9-6A07-4DF0-A458-6AD4C9D18A07}"
|
| 17 |
+
EndProject
|
| 18 |
Global
|
| 19 |
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
| 20 |
Debug|x64 = Debug|x64
|
|
|
|
| 63 |
{08DE3CE9-D0C0-4426-AAA6-1ADA88494BE3}.Release|x64.Build.0 = Release|x64
|
| 64 |
{08DE3CE9-D0C0-4426-AAA6-1ADA88494BE3}.Release|x86.ActiveCfg = Release|Win32
|
| 65 |
{08DE3CE9-D0C0-4426-AAA6-1ADA88494BE3}.Release|x86.Build.0 = Release|Win32
|
| 66 |
+
{47E51CB9-6A07-4DF0-A458-6AD4C9D18A07}.Debug|x64.ActiveCfg = Debug|x64
|
| 67 |
+
{47E51CB9-6A07-4DF0-A458-6AD4C9D18A07}.Debug|x64.Build.0 = Debug|x64
|
| 68 |
+
{47E51CB9-6A07-4DF0-A458-6AD4C9D18A07}.Debug|x86.ActiveCfg = Debug|Win32
|
| 69 |
+
{47E51CB9-6A07-4DF0-A458-6AD4C9D18A07}.Debug|x86.Build.0 = Debug|Win32
|
| 70 |
+
{47E51CB9-6A07-4DF0-A458-6AD4C9D18A07}.Release|x64.ActiveCfg = Release|x64
|
| 71 |
+
{47E51CB9-6A07-4DF0-A458-6AD4C9D18A07}.Release|x64.Build.0 = Release|x64
|
| 72 |
+
{47E51CB9-6A07-4DF0-A458-6AD4C9D18A07}.Release|x86.ActiveCfg = Release|Win32
|
| 73 |
+
{47E51CB9-6A07-4DF0-A458-6AD4C9D18A07}.Release|x86.Build.0 = Release|Win32
|
| 74 |
EndGlobalSection
|
| 75 |
GlobalSection(SolutionProperties) = preSolution
|
| 76 |
HideSolutionNode = FALSE
|
src/Constant.cpp
CHANGED
|
@@ -12,6 +12,6 @@ std::filesystem::path getExecutablePath() {
|
|
| 12 |
|
| 13 |
const std::filesystem::path Constant::exePath = getExecutablePath(); // std::filesystem::current_path();
|
| 14 |
|
| 15 |
-
const std::
|
| 16 |
|
| 17 |
std::filesystem::path curr_pth = std::filesystem::current_path(); // 当前工作目录 (可能是解决方案所在目录)
|
|
|
|
| 12 |
|
| 13 |
const std::filesystem::path Constant::exePath = getExecutablePath(); // std::filesystem::current_path();
|
| 14 |
|
| 15 |
+
const std::filesystem::path Constant::pth_wechatocr_dll = (exePath / std::filesystem::path("WeChatOcrCpp.dll")).lexically_normal(); // .string();
|
| 16 |
|
| 17 |
std::filesystem::path curr_pth = std::filesystem::current_path(); // 当前工作目录 (可能是解决方案所在目录)
|
src/Constant.h
CHANGED
|
@@ -7,6 +7,6 @@ class Constant
|
|
| 7 |
public:
|
| 8 |
static const std::filesystem::path exePath;
|
| 9 |
// ocr dll pth
|
| 10 |
-
static const std::
|
| 11 |
};
|
| 12 |
|
|
|
|
| 7 |
public:
|
| 8 |
static const std::filesystem::path exePath;
|
| 9 |
// ocr dll pth
|
| 10 |
+
static const std::filesystem::path pth_wechatocr_dll;
|
| 11 |
};
|
| 12 |
|
src/WeChatOcrCpp/WeChatOcrCpp.vcxproj
CHANGED
|
@@ -122,7 +122,7 @@
|
|
| 122 |
<SDLCheck>true</SDLCheck>
|
| 123 |
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
| 124 |
<ConformanceMode>true</ConformanceMode>
|
| 125 |
-
<AdditionalIncludeDirectories>E:\huggingface\
|
| 126 |
<LanguageStandard>stdcpp17</LanguageStandard>
|
| 127 |
<Optimization>Disabled</Optimization>
|
| 128 |
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
|
@@ -133,7 +133,7 @@
|
|
| 133 |
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
| 134 |
<OptimizeReferences>true</OptimizeReferences>
|
| 135 |
<GenerateDebugInformation>true</GenerateDebugInformation>
|
| 136 |
-
<AdditionalLibraryDirectories>E:\huggingface\
|
| 137 |
<AdditionalDependencies>libprotobuf.lib;opencv_core4120.lib;opencv_highgui4120.lib;opencv_imgcodecs4120.lib;opencv_imgproc4120.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
| 138 |
</Link>
|
| 139 |
</ItemDefinitionGroup>
|
|
|
|
| 122 |
<SDLCheck>true</SDLCheck>
|
| 123 |
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
| 124 |
<ConformanceMode>true</ConformanceMode>
|
| 125 |
+
<AdditionalIncludeDirectories>E:\huggingface\imradv3\3rdparty\opencv\include;E:\huggingface\imradv3\src\WeChatOcrCpp\protobuf\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
| 126 |
<LanguageStandard>stdcpp17</LanguageStandard>
|
| 127 |
<Optimization>Disabled</Optimization>
|
| 128 |
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
|
|
|
| 133 |
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
| 134 |
<OptimizeReferences>true</OptimizeReferences>
|
| 135 |
<GenerateDebugInformation>true</GenerateDebugInformation>
|
| 136 |
+
<AdditionalLibraryDirectories>E:\huggingface\imradv3\src\WeChatOcrCpp\protobuf\lib;E:\huggingface\imradv3\3rdparty\opencv\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
| 137 |
<AdditionalDependencies>libprotobuf.lib;opencv_core4120.lib;opencv_highgui4120.lib;opencv_imgcodecs4120.lib;opencv_imgproc4120.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
| 138 |
</Link>
|
| 139 |
</ItemDefinitionGroup>
|
src/WeChatOcrCpp/main.cpp
CHANGED
|
@@ -47,7 +47,7 @@ int main()
|
|
| 47 |
//json jsn;
|
| 48 |
//std::string jsn_str;
|
| 49 |
|
| 50 |
-
std::string result = rec("E:\\huggingface\\
|
| 51 |
json jsn;
|
| 52 |
std::string jsn_str;
|
| 53 |
|
|
|
|
| 47 |
//json jsn;
|
| 48 |
//std::string jsn_str;
|
| 49 |
|
| 50 |
+
std::string result = rec("E:\\huggingface\\imradv3\\data\\t2.jpg");
|
| 51 |
json jsn;
|
| 52 |
std::string jsn_str;
|
| 53 |
|
src/main.cpp
CHANGED
|
@@ -2623,16 +2623,19 @@ int main(int argc, const char* argv[])
|
|
| 2623 |
|
| 2624 |
|
| 2625 |
|
| 2626 |
-
|
| 2627 |
-
|
| 2628 |
|
| 2629 |
-
|
| 2630 |
|
| 2631 |
-
|
| 2632 |
|
| 2633 |
-
|
| 2634 |
|
| 2635 |
-
|
|
|
|
|
|
|
|
|
|
| 2636 |
|
| 2637 |
// Setup window
|
| 2638 |
glfwSetErrorCallback(glfw_error_callback);
|
|
|
|
| 2623 |
|
| 2624 |
|
| 2625 |
|
| 2626 |
+
HINSTANCE ghDLL = NULL;
|
| 2627 |
+
ghDLL = LoadLibrary(Constant::pth_wechatocr_dll.wstring().c_str()); // "E:\\huggingface\\ColorTextEditorV2\\build\\x64\\Release\\WeChatOcrCpp.dll"
|
| 2628 |
|
| 2629 |
+
typedef const char* (_cdecl* FunctionPtr) (const char* pth_img);
|
| 2630 |
|
| 2631 |
+
FunctionPtr rec;
|
| 2632 |
|
| 2633 |
+
rec = (FunctionPtr)GetProcAddress(ghDLL, "rec");
|
| 2634 |
|
| 2635 |
+
std::string result = rec("E:\\huggingface\\imradv3\\data\\t2.jpg");
|
| 2636 |
+
|
| 2637 |
+
json jsn = json::parse(result);
|
| 2638 |
+
std::string jsn_str = jsn.dump(4);
|
| 2639 |
|
| 2640 |
// Setup window
|
| 2641 |
glfwSetErrorCallback(glfw_error_callback);
|