centos7下安装tesseract-ocr进行验证码识别,centos7 安装tesseract ,yum安装tesseract
step 1 :
yum install tesseract -y
查看 tesseract -v
step 2: install more language
yum install -y tesseract-langpack-rus
转自 http://tutorialspots.com/how-to-install-tesseract-on-centos-7-4500.html
1 安装centos系统依赖
yum install -y automake autoconf libtool gcc gcc-c++ yum install -y libpng-devel libjpeg-devel libtiff-devel
--部分新服务器需要 yum install gtk2-devel yasm glibc.i686 libstdc++.so.6 libgtk-x11-2.0.so libatk-1.0.so.0 libcairo.so.2 libcups.so.2 libgdk-x11-2.0.so.0 libgdk_pixbuf-2.0.so.0 libgtk-x11-2.0.so.0 libpango-1.0.so.0 libpangocairo-1.0.so.0 libICE.so.6 libSM.so.6 libmng.so.1 libpng12.so.0 libGLU.so.1 -y
2
安装leptonica
wget http://www.leptonica.org/source/leptonica-1.72.tar.gz
tar xvzf leptonica-1.72.tar.gz
cd leptonica-1.72/
./configure --prefix=/usr/local/
make && make install
配置环境 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=/usr/local/share/tessdata export TESSDATA_PREFIX 最后刷新 source /etc/bashrc
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
3
安装tesseract-ocr
wget https://github.com/tesseract-ocr/tesseract/archive/3.04.zip
unzip 3.04.zip
cd tesseract-3.04/
./autogen.sh
./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/include
make && make install
sudo ldconfig
4
- 在https://github.com/tesseract-ocr/tessdata 下载对应语言的模型文件
- 将模型文件移动到/usr/local/share/tessdata
(eng.traineddata osd.traineddata)
https://www.cnblogs.com/panpan61803/p/10978117.html
https://www.cnblogs.com/arachis/p/OCR.html
https://blog.csdn.net/diyiday/article/details/80004793