1、安装依赖工具
yum install autoconf automake libtool libjpeg-devel libpng-devel libtiff-devel zlib-devel

 

2、编译安装leptonica
wget http://www.leptonica.org/source/leptonica-1.74.4.tar.gz
tar zxvf leptonica-1.74.4.tar.gz leptonica-1.74.4
cd leptonica-1.74.4/
./configure --prefix=/usr/local/leptonica
make
make install

 

 3、配置环境变量
vi /etc/profile

添加:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/leptonica/lib/pkgconfig
export PKG_CONFIG_PATH
CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/leptonica/include/leptonica
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/leptonica/lib
export LD_LIBRARY_PATH
LIBRARY_PATH=$LIBRARY_PATH:/usr/local/leptonica/lib
export LIBRARY_PATH
LIBLEPT_HEADERSDIR=/usr/local/leptonica/include/leptonica
export LIBLEPT_HEADERSDIR
 
source /etc/profile

 

4、编译安装tesseract
git clone https://github.com/tesseract-ocr/tesseract.git
cd tesseract
./autogen.sh
./configure --prefix=/usr/local/tesseract --with-extra-libraries=/usr/local/leptonica/lib   
make
make install
make training
make training-install
 
5、配置环境变量
vi /etc/profile
 
添加:
PATH=$PATH:/usr/local/tesseract/bin
export PATH
 
source /etc/profile 

 

6、测试安装是否成功

tesseract -v

显示:
tesseract 4.00.00alpha
 leptonica-1.74.4
  libgif 4.1.6(?) : libjpeg 6b (libjpeg-turbo 1.2.90) : libpng 1.5.13 : zlib 1.2.7 : libwebp 0.3.0

 Found SSE

 

转载于:https://www.cnblogs.com/rouge/p/7275391.html

GitHub 加速计划 / te / tesseract
16
3
下载
tesseract-ocr/tesseract: 是一个开源的光学字符识别(OCR)引擎,适用于从图像中提取和识别文本。特点是可以识别多种语言,具有较高的识别准确率,并且支持命令行和API调用。
最近提交(Master分支:4 个月前 )
014b9d00 - 22 天前
13c966b7 - 25 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐