Windows(VS2008) 下 build tesseract
来源:互联网 发布:风险评估矩阵表 编辑:程序博客网 时间:2024/05/16 09:40
参考:http://www.myexception.cn/vsts/1118613.html
Build 过程:
- 选定tesseract 主目录,比如 E:\tesseract
- 在E:\tesseract 下创建子目录 tesseract-svn,从该子目录拉tesseract svn代码:svn checkout http://tesseract-ocr.googlecode.com/svn/trunk/ (tesseract svn相关页面)
- 从Leptonica download页面下载 leptonica-1.68-win32-lib-include-dirs.zip
- 在E:\tesseract 下创建子目录 lib 和 include,将leptonica-1.68-win32-lib-include-dirs.zip 解压后的include 路径下所有文件和子文件夹copy到 E:\tesseract\include 中,将 leptonica-1.68-win32-lib-include-dirs.zip 解压后的lib 路径下所有文件copy到 E:\tesseract\lib 中
- 打开 E:\tesseract\tesseract-svn\vs2008\tesseract.sln,build libtesseract302 工程(默认是DLL _Debug),在E:\tesseract\tesseract-svn\vs2008\DLL_Debug下会生成libtesseract302d.dll 和libtesseract302d.lib。其他版本,如DLL_Release,做法类似。
- 在E:\tesseract 下创建子目录tessdata,从这里下载tesseract-ocr-3.02.eng.tar.gz、tesseract-ocr-3.02.chi_sim.tar.gz 和 tesseract-ocr-3.02.chi_tra.tar.gz,将它们都解压到E:\tesseract\tessdata中
- 添加环境变量 TESSDATA_PREFIX,值为tessdata文件夹的上一级文件夹,即 E:\tesseract
运行:
在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目录结构如下:
E:\tesseract\tessdata 下的文件类似:
6)添加了环境变量TESSDATA_PREFIX 之后,如果tesseract.exe还是不能正常工作,请将cmd终端关闭后重新打开,再重试。
7)添加了环境变量TESSDATA_PREFIX 之后,调试tesseract工程时,总是识别失败,结果发现时执行getenv() 函数获取环境变量TESSDATA_PREFIX 值的时候失败了(ln 54):
解决办法:关闭VC重新打开,再重试
- Windows(VS2008) 下 build tesseract
- Windows(VS2008) 下 build tesseract
- CentOS 6.3 下build tesseract
- Tesseract-ocr在vs2008环境下的调用方法
- VS2008 下开发Windows Service(框架)
- VS2008 下开发Windows Service(框架)
- vs2008中tesseract配置
- Windows+VS2008 下使用pthread
- Tesseract-OCR Windows下不换行的问题研究
- Windows 7下VS2008升级到正式版
- Windows 7下VS2008升级补丁
- VS2008下WINDOWS服务的开发
- VS2008下WINDOWS服务的开发
- Windows 7下VS2008升级补丁
- Windows 7下VS2008升级补丁
- Windows下使用VS2008编译RobotVision库
- windows 7下成功安装VS2008 + SP1
- Windows 7下VS2008升级补丁
- node.js的generic-pool与mysql结合,mysql连接池
- linux设备驱动篇之LED驱动(一)
- 一个c++程序员关于跳槽话题的随想
- Myeclipse 连接MSSqlServer
- linux内核下模块支持没有开启报的错误
- Windows(VS2008) 下 build tesseract
- 计算广告的流程
- 解决手机QQ协议只能获取五十好友的问题!
- 多线程之mutex、semaphore区别
- 分享一些资料(侧重Linux)
- eclipse 语言包
- 字符串
- hdu 2552 (这题很强大)
- 类型(type)、类、接口、对象、契约