在linux下安装tesseract-ocr

32 篇文章 4 订阅

注意:下面的下载网址和版本有更新的以最新的为准



1. 在ubuntu下可以自动安装  

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sudo apt-get install tesseract-ocr  

2.编译安装

    a.编译环境: gcc gcc-c++ make(这个环境一般机器都具备,可以忽略)   

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. yum install gcc gcc-c++ make  


    b.安装tesseract-ocr编译必须的包

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. yum/apt-get install autoconf automake libtool  


    c.增加图像解析需要的包,可以按照指定的格式选择包

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. yum install libjpeg-devel libpng-devel libtiff-devel zlib-devel  

    ubuntu

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sudo apt-get install libpng12-dev  
  2. sudo apt-get install libjpeg62-dev  
  3. sudo apt-get install libtiff4-dev  

    d.下载 leptonica 包: http://www.leptonica.org/source/leptonica-1.71.tar.gz
[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. wget http://www.leptonica.org/source/leptonica-1.71.tar.gz  
  2. tar -zxvf ...  
  3. ./configure  
  4. make  
  5. make install  


需要注意,leptonica的版本问题

3.01 requires at least v1.67 of Leptonica.
3.02 requires at least v1.69 of Leptonica. (Both available in Ubuntu 12.04 Precise Pangolin.)
3.03 requires at least v1.70 of Leptonica. (Both available in Ubuntu 14.04 Trusty Tahr.)

如果版本不一致,会出现问题如下:

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. Tesseract Open Source OCR Engine v3.02.02 with Leptonica  
  2. Error in findTiffCompression: function not present  
  3. Error in pixReadStreamTiff: function not present  
  4. Error in pixReadStream: tiff: no pix returned  
  5. Error in pixRead: pix not read  
  6. Unsupported image type.  


    e.下载 tesseract-3.02 安装包: http://tesseract-ocr.googlecode.com/files/tesseract-3.02.02.tar.gz

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. wget http://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz  
  2. ./autogen.sh  
  3. ./configure  
  4. make  
  5. make install  
  6. ldconfig  

    f.下载 tesseract-3.02 英文语言包: http://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.eng.tar.gz,解压后将 tesseract-ocr/tessdata 下的所有文件全部拷贝到 /usr/local/share/tessdata 下。



     测试

[html]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. tesseract phototest.tif phototest -l eng  
这时应该在当前目录生成一个 phototest.txt 文本文件,内容就是 phototest.tif 显示的文字.

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值