参考:http://www.myexception.cn/vsts/1118613.html
在E:\tesseract\pic 下创建英文文本截图文件 eng.png
cd E:\tesseract\tesseract-svn\vs2008\LIB_Debug
tesseractd.exe E:\tesseract\pic\eng.png E:\tesseract\pic\eng
会在E:\tesseract\pic 下生成识别出来的文本文件 eng.txt
1)build 过程中,遇到下面的问题
error PRJ0002 : Error result 31 returned from 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe'
解决办法:Properties -> Configuration Properties -> Linker -> Manifest File, set Generate Manifest to No
2)VS2008中,可能会遇到 带有中文字符编码的源文件编译报错的问题:ccmain/equationdetect.cpp
1>..\..\ccmain\equationdetect.cpp(251) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
1>..\..\ccmain\equationdetect.cpp(251) : error C2146: syntax error : missing '}' before identifier '銆'
1>..\..\ccmain\equationdetect.cpp(251) : error C2146: syntax error : missing ';' before identifier '銆'
1>..\..\ccmain\equationdetect.cpp(251) : error C2065: '銆' : undeclared identifier
1>..\..\ccmain\equationdetect.cpp(251) : error C2146: syntax error : missing ';' before identifier '銆'
1>..\..\ccmain\equationdetect.cpp(251) : error C2065: '銆' : undeclared identifier
1>..\..\ccmain\equationdetect.cpp(251) : error C2146: syntax error : missing ';' before identifier '銆'
1>..\..\ccmain\equationdetect.cpp(251) : error C2065: '銆' : undeclared identifier
1>..\..\ccmain\equationdetect.cpp(251) : error C2143: syntax error : missing ';' before '}'
1>..\..\ccmain\equationdetect.cpp(253) : error C2065: 'kCharsToEx' : undeclared identifier
解决办法:全选编码出错的源文件,在VS2008中,File => Advanced Save Options => Encoding选择“Chinese Simplified (GB2312) - Codepage 936”
3)以下工程只能以LIB_Debug 或LIB_Release方式build,用DLL方式build会出错(tesseract官网有说明):
ambiguous_words
classifier_tester
cntraining
combine_tessdata
dawg2wordlist
mftraining
shapeclustering
unicharset_extractor
wordlist2dawg
4)运行tesseract的exe时,遇到下面的问题
"The program can't start because liblept168.dll is missing from your computer"
请将E:\tesseract\lib\liblept168.dll 或E:\tesseract\lib\liblept168d.dll copy到tesseract的exe所在目录
5)上面的build过程中,示例的 tesseract目录结构如下:
6)添加了环境变量TESSDATA_PREFIX 之后,如果tesseract.exe还是不能正常工作,请将cmd终端关闭后重新打开,再重试。
7)添加了环境变量TESSDATA_PREFIX 之后,调试tesseract工程时,总是识别失败,结果发现时执行getenv() 函数获取环境变量TESSDATA_PREFIX 值的时候失败了(ln 54):
解决办法:关闭VC重新打开,再重试