安装Tesseract-OCR

安装Tesseract-OCR
准备工作:
编译环境: gcc gcc-c++ make(这个环境一般机器都具备,可以忽略)  
1
yum install gcc gcc-c++ make
 依赖的包: autoconf automake libtool libjpeg-devel libpng-devel libtiff-devel zlib-devel leptonica(1.67以上)
 
 
1. autoconf automake libtool libjpeg-devel libpng-devel libtiff-devel zlib-devel 可以通过yum安装:
1
yum install autoconf automake libtool
2
yum install libjpeg-devel libpng-devel libtiff-devel zlib-devel
2. leptonica 需要源码编译安装
 参考资料:
 http://paramountideas.com/tesseract-ocr-30-and-leptonica-installation-centos-55-and-opensuse-113
 http://www.leptonica.org/source/README.html
  下载 leptonica 包: http://www.leptonica.org/source/leptonica-1.68.tar.gz
 解压后切换到leptonica-1.68 根目录  
1
./configure
2
make
3
make install
tesseract安装:
 依赖安装完毕后开始安装tesseract
 下载tesseract-3.01 安装包: http://tesseract-ocr.googlecode.com/files/tesseract-3.01.tar.gz
 解压后切换到tesseract-3.01 根目录
 (如果在make时遇到类似strngs.h:1: error: stray '\357' in program 的错误,请将tesseract-3.01/ccutil/strngs.h 文件转为ANSI 编码保存,再重新编译)  
1
./autogen.sh
2
./configure
3
make
4
make install
5
ldconfig
tesseract英文语言包安装:  
 下载tesseract-3.01 英文语言包: http://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.01.eng.tar.gz
 解压后将tesseract-ocr/tessdata 下的所有文件全部拷贝到/usr/local/share/tessdata 下
安装完毕.
测试一下:
 切换到解压后的tesseract-3.01 根目录(这个目录下有一个自带的phototest.tif 可以做测试用)
 命令行:
1
tesseract phototest.tif phototest -l eng
 输出:
1
Tesseract Open Source OCR Engine v3.01 with Leptonica
2
Page 0
 这时应该在当前目录生成一个phototest.txt 文本文件,内容就是phototest.tif 显示的文字.

 

tesseract phototest.tif phototest -l eng
Tesseract Open Source OCR Engine v3.01 with Leptonica
Error in findTiffCompression: function not present
Error in pixReadStreamTiff: function not present

Error in pixReadStream: tiff: no pix returned
Error in pixRead: pix not read
Unsupported image type



  摘自 雪人的博客
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值