tesseract5.0拥有更高的准确度的同时可以使用白名单进行识别的筛选,基于windows目前有很多安装好的压缩包直接安装即可,具体可见https://digi.bib.uni-mannheim.de/tesseract/但是其基于linux的安装却需没有很好的安装包,需要从源码进行编译,其具体安装方式如下:

1. git clone https://github.com/tesseract-ocr/tesseract.git
2. wget http://www.leptonica.org/source/leptonica-1.78.0.tar.gz
3. tar -xzvf leptonica-1.78.0.tar.gz 
4. cd leptonica-1.78.0 
   sudo apt-get install zlib1g-dev  libpng-dev  giflib-tools  libtiff-dev  gem-plugin-jpeg  libopenjpeg-dev libopenjp2-7-dev  libjpeg-dev
5. ./configure  --prefix=/usr/local/ --with-zlib --with-libpng  --with-libtiff --with-libopenjpeg  --with-jpeg
6. make && make install
7. vim /etc/profile
   在最后插入
   export LD_LIBRARY_PATH=$LD_LIBRARY_PAYT:/usr/local/lib
   export LIBLEPT_HEADERSDIR=/usr/local/include
   export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
   source /etc/profile 
8. 配置环境
   vim /etc/bashrc
   加入
   PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
   export PKG_CONFIG_PATH
   CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/
   export CPLUS_INCLUDE_PATH
   C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/leptonica/include/leptonica
   export C_INCLUDE_PATH
   LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
   export LD_LIBRARY_PATH
   LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
   export LIBRARY_PATH
   TESSDATA_PREFIX=/root/tesseract/
   export TESSDATA_PREFIX
   最后刷新
   source /etc/bashrc
7. sudo apt-get   install automake -y
8. sudo apt-get install  libtool -y
9. ./autogen.sh
10./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/include
11. make && sudo make install
12. vi /etc/ld.so.conf 添加/usr/local/lib然后ldconfig 
13. 在/usr/local/share/tessdata 目录下放入对应的语言包

安装结束后可以输入tesseract --version查看对应的版本若显示:

则表示安装完成,其中第一行显示的是tesseract的版本,红匡内表示的是支持的图片格式,若没有该部分则表示安装存在问题

 

常见错误:

如果在安装过程中出现无法定位软件包可尝试在source.list中vim /etc/apt/sources.list添加如下源,然后执行 sudo apt-get update

deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
deb http://http.kali.org/ /kali main contrib non-free
deb http://http.kali.org/ /wheezy main contrib non-free
deb http://http.kali.org/kali kali-dev main contrib non-free
 

Logo

更多推荐