CentOs install Tesseract

    1. 安装依赖包

      yum install gcc gcc-c++ make

      yum install autoconf automake libtool

      yum install libjpeg-devel libpng-devel libtiff-devel zlib-devel

    2. 源码安装leptonica

      下载

      wget  http://www.leptonica.org/source/leptonica-1.72.tar.gz

                解压

                tar xf leptonica-1.72.tar.gz

                cd  leptonica-1.72

                ./configure && make && sudo make install


2. 源码安装Tesseract

        1)下载

        wget https://github.com/tesseract-ocr/tesseract/archive/master.zip

        2)安装

        ./autogen.sh

        configure && make && make install

        ldconfig

        3) 设置环境变量

        cd

        vi .bashrc

        #在最后添加

        export TESSDATA_PREFIX=/usr/local/share

        source .bashrc #使之生效

    

        3) 下载tessdata

        git clone https://github.com/tesseract-ocr/tessdata.git

            # 把训练好的数据给放到tessdata中

           cp tessdata /usr/local/share -R


3. 测试

    cd /root/tesseract-master/testing

    tesseract phototest.tif phototest -l eng

    [root@SZB-L0006409 testing]# pwd

    /root/tesseract-master/testing

    [root@SZB-L0006409 testing]# tesseract phototest.tif phototest -l eng

    Tesseract Open Source OCR Engine v3.05.00dev with Leptonica

    Page 1

    Warning in pixReadMemTiff: tiff page 1 not found


5. 安装pytesseract

    pip install pytesseract

from PIL import Image
import pytesseract
print pytesseract.image_to_string(Image.open('2ca28b68994436891d3b99a3612aa87c.jpg'))

转载于:https://my.oschina.net/ayy/blog/663592

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值