我通过Tesseract wiki来安装来自source code的 Tesseract 3.05.1 ,但是当compiling with cppan(当我启动它时,它停止)我遇到了问题并尝试了unofficael installer,但没有找到我必须从他们建造的Tesseract中包含的库。所以,我不知道该怎么做才能在2017年的Visual Studio上使用适用于我的Windows 64bit的Tesseract版本。
注意:我已经使用cmake为visual studio 15 2017 64bit生成了opencv build。 =>我希望我的项目能够在x64上运行,而不是win32(x68)。
我有tesseract 3.02但是在项目中编译它会导致错误。(x86和x64之间的冲突)和 我不喜欢使用Tesseract 3.02 因为它是一个旧版本。
尝试使用Tesseract 3.02进行测试时出现的错误如下代码所示:
#include <baseapi.h>
#include <allheaders.h>
#include <iostream>
using namespace std;
int main(void) {
tesseract::TessBaseAPI api;
api.Init("", "eng", tesseract::OEM_DEFAULT);
api.SetPageSegMode(static_cast<tesseract::PageSegMode>(7));
api.SetOutputName("out");
cout << "File name : ";
char image[256];
cin >> image;
PIX *pixs = pixRead(image);
STRING text_out;
api.ProcessPages(image, NULL, 0, &text_out);
cout << text_out.string();
}
错误:
1>------ Build started: Project: RedEyeRemover, Configuration: Debug x64 ------
1>redEyeRemover.obj : error LNK2019: unresolved external symbol "public: __cdecl STRING::STRING(void)" (??0STRING@@QEAA@XZ) referenced in function main
1>redEyeRemover.obj : error LNK2019: unresolved external symbol "public: __cdecl STRING::~STRING(void)" (??1STRING@@QEAA@XZ) referenced in function main
1>redEyeRemover.obj : error LNK2019: unresolved external symbol "public: char const * __cdecl STRING::string(void)const " (?string@STRING@@QEBAPEBDXZ) referenced in function main
1>redEyeRemover.obj : error LNK2019: unresolved external symbol "public: __cdecl tesseract::TessBaseAPI::TessBaseAPI(void)" (??0TessBaseAPI@tesseract@@QEAA@XZ) referenced in function main
1>redEyeRemover.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl tesseract::TessBaseAPI::~TessBaseAPI(void)" (??1TessBaseAPI@tesseract@@UEAA@XZ) referenced in function main
1>redEyeRemover.obj : error LNK2019: unresolved external symbol "public: void __cdecl tesseract::TessBaseAPI::SetOutputName(char const *)" (?SetOutputName@TessBaseAPI@tesseract@@QEAAXPEBD@Z) referenced in function main
1>redEyeRemover.obj : error LNK2019: unresolved external symbol "public: int __cdecl tesseract::TessBaseAPI::Init(char const *,char const *,enum tesseract::OcrEngineMode,char * *,int,class GenericVector<class STRING> const *,class GenericVector<class STRING> const *,bool)" (?Init@TessBaseAPI@tesseract@@QEAAHPEBD0W4OcrEngineMode@2@PEAPEADHPEBV?$GenericVector@VSTRING@@@@3_N@Z) referenced in function "public: int __cdecl tesseract::TessBaseAPI::Init(char const *,char const *,enum tesseract::OcrEngineMode)" (?Init@TessBaseAPI@tesseract@@QEAAHPEBD0W4OcrEngineMode@2@@Z)
1>redEyeRemover.obj : error LNK2019: unresolved external symbol "public: void __cdecl tesseract::TessBaseAPI::SetPageSegMode(enum tesseract::PageSegMode)" (?SetPageSegMode@TessBaseAPI@tesseract@@QEAAXW4PageSegMode@2@@Z) referenced in function main
1>redEyeRemover.obj : error LNK2019: unresolved external symbol "public: bool __cdecl tesseract::TessBaseAPI::ProcessPages(char const *,char const *,int,class STRING *)" (?ProcessPages@TessBaseAPI@tesseract@@QEAA_NPEBD0HPEAVSTRING@@@Z) referenced in function main
1>redEyeRemover.obj : error LNK2019: unresolved external symbol pixRead referenced in function main
1>C:\Program Files\tesseract\lib\libtesseract302.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'
1>C:\Program Files\tesseract\lib\libtesseract302d.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'
1>C:\Program Files\tesseract\lib\liblept168.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'
1>C:\Program Files\tesseract\lib\liblept168d.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'
1>C:\Users\M\documents\visual studio 2017\Projects\RedEyeRemover\x64\Debug\RedEyeRemover.exe : fatal error LNK1120: 10 unresolved externals
1>Done building project "RedEyeRemover.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
我知道这些错误是由调试模式x64造成的,而我使用的库是针对x86的,但是如何让它们适用于x64?