目前应用场景须要用到图片文字识别,网上搜了一下,开源的库tesseract口碑不错,决定安装试试。c++
下面主要描述服务端 CentOS6.5 安装 tesseract3.05 版本。git
一、先更新依赖github
yum -y update
yum -y install libstdc++ autoconf automake libtool autoconf-archive pkg-config gcc gcc-c++ make libjpeg-devel libpng-devel libtiff-devel zlib-develcentos
#Install AutoConf-Archive
wget ftp://mirror.switch.ch/pool/4/mirror/epel/7/ppc64/a/autoconf-archive-2016.09.16-1.el7.noarch.rpm
rpm -i autoconf-archive-2016.09.16-1.el7.noarch.rpm测试
二、下载并安装依赖程序leptonicaui
#Install Leptonica from Source
wget http://www.leptonica.com/source/leptonica-1.74.1.tar.gz
tar -zxvf leptonica-1.74.1.tar.gz
cd leptonica-1.74.1
./autobuild
./configure
make
make install
cd ...net
三、下载并安装tesseract3.05blog
wget https://github.com/tesseract-ocr/tesseract/archive/3.05.zip图片
unzip 3.05.zipip
cd tesseract-3.05/
./autogen.sh
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig LIBLEPT_HEADERSDIR=/usr/local/include ./configure --with-extra-includes=/usr/local/include --with-extra-libraries=/usr/local/lib
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make
make install
ldconfig
cd ..
四、下载语言包并放置到目录 /usr/local/share/tessdata
cd /usr/local/share/tessdata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/chi_sim.traineddata
wget https://github.com/tesseract-ocr/tessdata/raw/3.04.00/eng.traineddata
五、能够上传一个小图片作测试了
参考:
http://stackoverflow.com/questions/23792373/installing-tesseract-ocr-on-centos-6
http://blog.csdn.net/diandianxiyu_geek/article/details/50522582