zoukankan      html  css  js  c++  java
  • 在linux下安装tesseract-ocr

    1. 在ubuntu下可以自动安装  

    [html] view plain copy
     
    1. sudo apt-get install tesseract-ocr  


    2.编译安装

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

    [html] view plain copy
     
    1. yum install gcc gcc-c++ make  

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

    [html] view plain copy
     
    1. yum/apt-get install autoconf automake libtool  

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

    [html] view plain copy
     
    1. yum install libjpeg-devel libpng-devel libtiff-devel zlib-devel  


        ubuntu

    [html] view plain copy
     
    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
     
    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
     
    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
     
    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
     
    1. tesseract phototest.tif phototest -l eng  

    这时应该在当前目录生成一个 phototest.txt 文本文件,内容就是 phototest.tif 显示的文字.

  • 相关阅读:
    Python数值计算:一 使用Pylab绘图(2)
    Python数值计算:一 使用Pylab绘图(1)
    Gromacs处理amino acid residues小结
    实用正则表达式匹配和替换
    将Word转为带书签的PDF
    QT在windows下实现截屏操作并保存为png图片
    VMware虚拟机无法识别U盘解决方案
    C/C++/Qt 统计运行时间
    ffmpeg 中 swscale 的用法
    用qt代码怎样编写图片保存格式[qt4.6]
  • 原文地址:https://www.cnblogs.com/txwen/p/8526795.html
Copyright © 2011-2022 走看看