fasdfsa commited on
Commit
3bca3f4
·
1 Parent(s): 60d4103

add wechatocr http 接口

Browse files
src/WeChatOcrCpp/WeChatOcrCpp.vcxproj CHANGED
@@ -1,184 +1,185 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <ItemGroup Label="ProjectConfigurations">
4
- <ProjectConfiguration Include="Debug|Win32">
5
- <Configuration>Debug</Configuration>
6
- <Platform>Win32</Platform>
7
- </ProjectConfiguration>
8
- <ProjectConfiguration Include="Release|Win32">
9
- <Configuration>Release</Configuration>
10
- <Platform>Win32</Platform>
11
- </ProjectConfiguration>
12
- <ProjectConfiguration Include="Debug|x64">
13
- <Configuration>Debug</Configuration>
14
- <Platform>x64</Platform>
15
- </ProjectConfiguration>
16
- <ProjectConfiguration Include="Release|x64">
17
- <Configuration>Release</Configuration>
18
- <Platform>x64</Platform>
19
- </ProjectConfiguration>
20
- </ItemGroup>
21
- <PropertyGroup Label="Globals">
22
- <VCProjectVersion>17.0</VCProjectVersion>
23
- <Keyword>Win32Proj</Keyword>
24
- <ProjectGuid>{47e51cb9-6a07-4df0-a458-6ad4c9d18a07}</ProjectGuid>
25
- <RootNamespace>WeChatOcrCpp</RootNamespace>
26
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27
- </PropertyGroup>
28
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30
- <ConfigurationType>Application</ConfigurationType>
31
- <UseDebugLibraries>true</UseDebugLibraries>
32
- <PlatformToolset>v143</PlatformToolset>
33
- <CharacterSet>Unicode</CharacterSet>
34
- </PropertyGroup>
35
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36
- <ConfigurationType>Application</ConfigurationType>
37
- <UseDebugLibraries>false</UseDebugLibraries>
38
- <PlatformToolset>v143</PlatformToolset>
39
- <WholeProgramOptimization>true</WholeProgramOptimization>
40
- <CharacterSet>Unicode</CharacterSet>
41
- </PropertyGroup>
42
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43
- <ConfigurationType>Application</ConfigurationType>
44
- <UseDebugLibraries>true</UseDebugLibraries>
45
- <PlatformToolset>v143</PlatformToolset>
46
- <CharacterSet>Unicode</CharacterSet>
47
- </PropertyGroup>
48
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49
- <ConfigurationType>DynamicLibrary</ConfigurationType>
50
- <UseDebugLibraries>false</UseDebugLibraries>
51
- <PlatformToolset>v143</PlatformToolset>
52
- <WholeProgramOptimization>true</WholeProgramOptimization>
53
- <CharacterSet>Unicode</CharacterSet>
54
- </PropertyGroup>
55
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56
- <ImportGroup Label="ExtensionSettings">
57
- </ImportGroup>
58
- <ImportGroup Label="Shared">
59
- </ImportGroup>
60
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62
- </ImportGroup>
63
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65
- </ImportGroup>
66
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68
- </ImportGroup>
69
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71
- </ImportGroup>
72
- <PropertyGroup Label="UserMacros" />
73
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74
- <ClCompile>
75
- <WarningLevel>Level3</WarningLevel>
76
- <SDLCheck>true</SDLCheck>
77
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
78
- <ConformanceMode>true</ConformanceMode>
79
- </ClCompile>
80
- <Link>
81
- <SubSystem>Console</SubSystem>
82
- <GenerateDebugInformation>true</GenerateDebugInformation>
83
- </Link>
84
- </ItemDefinitionGroup>
85
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
86
- <ClCompile>
87
- <WarningLevel>Level3</WarningLevel>
88
- <FunctionLevelLinking>true</FunctionLevelLinking>
89
- <IntrinsicFunctions>true</IntrinsicFunctions>
90
- <SDLCheck>true</SDLCheck>
91
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92
- <ConformanceMode>true</ConformanceMode>
93
- </ClCompile>
94
- <Link>
95
- <SubSystem>Console</SubSystem>
96
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
97
- <OptimizeReferences>true</OptimizeReferences>
98
- <GenerateDebugInformation>true</GenerateDebugInformation>
99
- </Link>
100
- </ItemDefinitionGroup>
101
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
102
- <ClCompile>
103
- <WarningLevel>Level3</WarningLevel>
104
- <SDLCheck>true</SDLCheck>
105
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
106
- <ConformanceMode>true</ConformanceMode>
107
- <LanguageStandard>stdcpp20</LanguageStandard>
108
- <AdditionalIncludeDirectories>E:\huggingface\iWeChatOcr\src\WeChatOcrCpp\protobuf\include;E:\huggingface\ColorTextEditorV2\3rdparty\opencv\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
109
- </ClCompile>
110
- <Link>
111
- <SubSystem>Console</SubSystem>
112
- <GenerateDebugInformation>true</GenerateDebugInformation>
113
- <AdditionalLibraryDirectories>E:\huggingface\iWeChatOcr\src\WeChatOcrCpp\protobuf\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
114
- <AdditionalDependencies>libprotobuf.lib;libprotoc.lib;%(AdditionalDependencies)</AdditionalDependencies>
115
- </Link>
116
- </ItemDefinitionGroup>
117
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
118
- <ClCompile>
119
- <WarningLevel>Level3</WarningLevel>
120
- <FunctionLevelLinking>true</FunctionLevelLinking>
121
- <IntrinsicFunctions>true</IntrinsicFunctions>
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>
129
- <WholeProgramOptimization>false</WholeProgramOptimization>
130
- </ClCompile>
131
- <Link>
132
- <SubSystem>Console</SubSystem>
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>
140
- <ItemGroup>
141
- <ClCompile Include="Constant.cpp" />
142
- <ClCompile Include="DefaultCallbacks.cpp" />
143
- <ClCompile Include="ImageOcr.cpp" />
144
- <ClCompile Include="main.cpp" />
145
- <ClCompile Include="MmmojoDll.cpp" />
146
- <ClCompile Include="OcrManager.cpp" />
147
- <ClCompile Include="protobuf\ocr_protobuf.pb.cc" />
148
- <ClCompile Include="Utilities.cpp" />
149
- <ClCompile Include="Wchtcr.cpp" />
150
- <ClCompile Include="WeChatOcrResult.cpp" />
151
- <ClCompile Include="XPluginManager.cpp" />
152
- </ItemGroup>
153
- <ItemGroup>
154
- <ClInclude Include="Constant.h" />
155
- <ClInclude Include="DefaultCallbacks.h" />
156
- <ClInclude Include="ImageOcr.h" />
157
- <ClInclude Include="MmmojoDll.h" />
158
- <ClInclude Include="OcrManager.h" />
159
- <ClInclude Include="protobuf\ocr_protobuf.pb.h" />
160
- <ClInclude Include="utf8.h" />
161
- <ClInclude Include="Utilities.h" />
162
- <ClInclude Include="Wchtcr.h" />
163
- <ClInclude Include="WeChatOcrResult.h" />
164
- <ClInclude Include="XPluginManager.h" />
165
- </ItemGroup>
166
- <ItemGroup>
167
- <Text Include="readme.txt" />
168
- </ItemGroup>
169
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
170
- <ImportGroup Label="ExtensionTargets">
171
- </ImportGroup>
172
- <ItemGroup>
173
- <Content Include="wco_data\**">
174
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
175
- <PackageCopyToOutput>true</PackageCopyToOutput>
176
- </Content>
177
- </ItemGroup>
178
- <ItemGroup>
179
- <Content Include="..\..\3rdparty\opencv\lib\*.dll">
180
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
181
- <Link>%(Filename)%(Extension)</Link>
182
- </Content>
183
- </ItemGroup>
 
184
  </Project>
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup Label="ProjectConfigurations">
4
+ <ProjectConfiguration Include="Debug|Win32">
5
+ <Configuration>Debug</Configuration>
6
+ <Platform>Win32</Platform>
7
+ </ProjectConfiguration>
8
+ <ProjectConfiguration Include="Release|Win32">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ <ProjectConfiguration Include="Debug|x64">
13
+ <Configuration>Debug</Configuration>
14
+ <Platform>x64</Platform>
15
+ </ProjectConfiguration>
16
+ <ProjectConfiguration Include="Release|x64">
17
+ <Configuration>Release</Configuration>
18
+ <Platform>x64</Platform>
19
+ </ProjectConfiguration>
20
+ </ItemGroup>
21
+ <PropertyGroup Label="Globals">
22
+ <VCProjectVersion>17.0</VCProjectVersion>
23
+ <Keyword>Win32Proj</Keyword>
24
+ <ProjectGuid>{47e51cb9-6a07-4df0-a458-6ad4c9d18a07}</ProjectGuid>
25
+ <RootNamespace>WeChatOcrCpp</RootNamespace>
26
+ <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27
+ </PropertyGroup>
28
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30
+ <ConfigurationType>Application</ConfigurationType>
31
+ <UseDebugLibraries>true</UseDebugLibraries>
32
+ <PlatformToolset>v143</PlatformToolset>
33
+ <CharacterSet>Unicode</CharacterSet>
34
+ </PropertyGroup>
35
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36
+ <ConfigurationType>Application</ConfigurationType>
37
+ <UseDebugLibraries>false</UseDebugLibraries>
38
+ <PlatformToolset>v143</PlatformToolset>
39
+ <WholeProgramOptimization>true</WholeProgramOptimization>
40
+ <CharacterSet>Unicode</CharacterSet>
41
+ </PropertyGroup>
42
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43
+ <ConfigurationType>Application</ConfigurationType>
44
+ <UseDebugLibraries>true</UseDebugLibraries>
45
+ <PlatformToolset>v143</PlatformToolset>
46
+ <CharacterSet>Unicode</CharacterSet>
47
+ </PropertyGroup>
48
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49
+ <ConfigurationType>Application</ConfigurationType>
50
+ <UseDebugLibraries>false</UseDebugLibraries>
51
+ <PlatformToolset>v143</PlatformToolset>
52
+ <WholeProgramOptimization>true</WholeProgramOptimization>
53
+ <CharacterSet>Unicode</CharacterSet>
54
+ </PropertyGroup>
55
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56
+ <ImportGroup Label="ExtensionSettings">
57
+ </ImportGroup>
58
+ <ImportGroup Label="Shared">
59
+ </ImportGroup>
60
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62
+ </ImportGroup>
63
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65
+ </ImportGroup>
66
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68
+ </ImportGroup>
69
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71
+ </ImportGroup>
72
+ <PropertyGroup Label="UserMacros" />
73
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74
+ <ClCompile>
75
+ <WarningLevel>Level3</WarningLevel>
76
+ <SDLCheck>true</SDLCheck>
77
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
78
+ <ConformanceMode>true</ConformanceMode>
79
+ </ClCompile>
80
+ <Link>
81
+ <SubSystem>Console</SubSystem>
82
+ <GenerateDebugInformation>true</GenerateDebugInformation>
83
+ </Link>
84
+ </ItemDefinitionGroup>
85
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
86
+ <ClCompile>
87
+ <WarningLevel>Level3</WarningLevel>
88
+ <FunctionLevelLinking>true</FunctionLevelLinking>
89
+ <IntrinsicFunctions>true</IntrinsicFunctions>
90
+ <SDLCheck>true</SDLCheck>
91
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92
+ <ConformanceMode>true</ConformanceMode>
93
+ </ClCompile>
94
+ <Link>
95
+ <SubSystem>Console</SubSystem>
96
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
97
+ <OptimizeReferences>true</OptimizeReferences>
98
+ <GenerateDebugInformation>true</GenerateDebugInformation>
99
+ </Link>
100
+ </ItemDefinitionGroup>
101
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
102
+ <ClCompile>
103
+ <WarningLevel>Level3</WarningLevel>
104
+ <SDLCheck>true</SDLCheck>
105
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
106
+ <ConformanceMode>true</ConformanceMode>
107
+ <LanguageStandard>stdcpp20</LanguageStandard>
108
+ <AdditionalIncludeDirectories>E:\huggingface\iWeChatOcr\src\WeChatOcrCpp\protobuf\include;E:\huggingface\ColorTextEditorV2\3rdparty\opencv\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
109
+ </ClCompile>
110
+ <Link>
111
+ <SubSystem>Console</SubSystem>
112
+ <GenerateDebugInformation>true</GenerateDebugInformation>
113
+ <AdditionalLibraryDirectories>E:\huggingface\iWeChatOcr\src\WeChatOcrCpp\protobuf\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
114
+ <AdditionalDependencies>libprotobuf.lib;libprotoc.lib;%(AdditionalDependencies)</AdditionalDependencies>
115
+ </Link>
116
+ </ItemDefinitionGroup>
117
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
118
+ <ClCompile>
119
+ <WarningLevel>Level3</WarningLevel>
120
+ <FunctionLevelLinking>true</FunctionLevelLinking>
121
+ <IntrinsicFunctions>true</IntrinsicFunctions>
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>
129
+ <WholeProgramOptimization>false</WholeProgramOptimization>
130
+ </ClCompile>
131
+ <Link>
132
+ <SubSystem>Console</SubSystem>
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>
140
+ <ItemGroup>
141
+ <ClCompile Include="Constant.cpp" />
142
+ <ClCompile Include="DefaultCallbacks.cpp" />
143
+ <ClCompile Include="ImageOcr.cpp" />
144
+ <ClCompile Include="main.cpp" />
145
+ <ClCompile Include="MmmojoDll.cpp" />
146
+ <ClCompile Include="OcrManager.cpp" />
147
+ <ClCompile Include="protobuf\ocr_protobuf.pb.cc" />
148
+ <ClCompile Include="Utilities.cpp" />
149
+ <ClCompile Include="Wchtcr.cpp" />
150
+ <ClCompile Include="WeChatOcrResult.cpp" />
151
+ <ClCompile Include="XPluginManager.cpp" />
152
+ </ItemGroup>
153
+ <ItemGroup>
154
+ <ClInclude Include="Constant.h" />
155
+ <ClInclude Include="DefaultCallbacks.h" />
156
+ <ClInclude Include="httplib.h" />
157
+ <ClInclude Include="ImageOcr.h" />
158
+ <ClInclude Include="MmmojoDll.h" />
159
+ <ClInclude Include="OcrManager.h" />
160
+ <ClInclude Include="protobuf\ocr_protobuf.pb.h" />
161
+ <ClInclude Include="utf8.h" />
162
+ <ClInclude Include="Utilities.h" />
163
+ <ClInclude Include="Wchtcr.h" />
164
+ <ClInclude Include="WeChatOcrResult.h" />
165
+ <ClInclude Include="XPluginManager.h" />
166
+ </ItemGroup>
167
+ <ItemGroup>
168
+ <Text Include="readme.txt" />
169
+ </ItemGroup>
170
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
171
+ <ImportGroup Label="ExtensionTargets">
172
+ </ImportGroup>
173
+ <ItemGroup>
174
+ <Content Include="wco_data\**">
175
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
176
+ <PackageCopyToOutput>true</PackageCopyToOutput>
177
+ </Content>
178
+ </ItemGroup>
179
+ <ItemGroup>
180
+ <Content Include="..\..\3rdparty\opencv\lib\*.dll">
181
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
182
+ <Link>%(Filename)%(Extension)</Link>
183
+ </Content>
184
+ </ItemGroup>
185
  </Project>
src/WeChatOcrCpp/httplib.h ADDED
The diff for this file is too large to render. See raw diff
 
src/WeChatOcrCpp/main.cpp CHANGED
@@ -1,4 +1,6 @@
1
  
 
 
2
 
3
  #include <iostream>
4
  #include <thread>
@@ -11,6 +13,8 @@
11
 
12
  #include "nlohmann/json.hpp"
13
 
 
 
14
  using json = nlohmann::json;
15
 
16
  // DLL 入口点
@@ -39,6 +43,41 @@ extern "C" {
39
  }
40
  }
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  int main()
43
  {
44
  //Wchtcr wchtcr;
@@ -47,6 +86,16 @@ int main()
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;
 
1
  
2
+ // 在所有包含之前定义这个宏
3
+ #define WIN32_LEAN_AND_MEAN // for httplib.h
4
 
5
  #include <iostream>
6
  #include <thread>
 
13
 
14
  #include "nlohmann/json.hpp"
15
 
16
+ #include "httplib.h"
17
+
18
  using json = nlohmann::json;
19
 
20
  // DLL 入口点
 
43
  }
44
  }
45
 
46
+ // 启动HTTP服务器的函数
47
+ void StartHttpServer(int port) {
48
+ httplib::Server svr;
49
+
50
+ // 添加POST接口,接收base64编码的图片
51
+ svr.Post("/wechatocr", [](const httplib::Request& req, httplib::Response& res) {
52
+ try {
53
+ // 解析请求体中的JSON数据
54
+ json request_data = json::parse(req.body);
55
+
56
+ //// 调用rec函数进行OCR识别
57
+ //std::string result = rec(temp_image_path.c_str());
58
+
59
+ // 返回识别结果
60
+ res.set_content("[]", "application/json");
61
+
62
+ //// 删除临时文件
63
+ //std::remove(temp_image_path.c_str());
64
+
65
+ }
66
+ catch (const std::exception& e) {
67
+ res.status = 500;
68
+ res.set_content("{\"error\":\"服务器内部错误: " + std::string(e.what()) + "\"}", "application/json");
69
+ }
70
+ });
71
+
72
+ // 添加一个简单的GET接口,用于测试服务器是否正常运行
73
+ svr.Get("/", [](const httplib::Request&, httplib::Response& res) {
74
+ res.set_content("OCR服务器正常运行中", "text/plain");
75
+ });
76
+
77
+ std::cout << "HTTP服务器已启动,监听端口: " << port << std::endl;
78
+ svr.listen("0.0.0.0", port);
79
+ }
80
+
81
  int main()
82
  {
83
  //Wchtcr wchtcr;
 
86
  //json jsn;
87
  //std::string jsn_str;
88
 
89
+ // 启动HTTP服务器,监听8080端口
90
+ std::thread server_thread(StartHttpServer, 7788);
91
+
92
+ // 分离线程,让它在后台运行
93
+ server_thread.detach();
94
+
95
+ // 主线程可以做其他事情,或者等待用户输入退出
96
+ std::cout << "OCR服务器已启动,按Enter键退出..." << std::endl;
97
+ std::cin.get();
98
+
99
  std::string result = rec("E:\\huggingface\\imradv3\\data\\t2.jpg");
100
  json jsn;
101
  std::string jsn_str;