依赖
安装centos系统依赖
-
yum install -y automake autoconf libtool gcc gcc-c++
-
yum install -y libpng-devel libjpeg-devel libtiff-devel
安装leptonica
github: https://github.com/danbloomberg/leptonica
- git clone https://github.com/danbloomberg/leptonica
- cd leptonica
- ./autogen.sh
- ./configure
- make
- make install
安装tesseract-ocr
github: https://github.com/tesseract-ocr/tesseract
- git clone https://github.com/tesseract-ocr/tesseract
- cd tesseract
- ./autogen.sh
- ./configure
- make
- make install
- ldconfig
下载训练库
https://github.com/jiangxd0716/tessdata
放入 /usr/local/share/tessdata
检查
[root@booking conf.d]# tesseract --version tesseract 5.0.0 leptonica-1.82.0 libjpeg 6b (libjpeg-turbo 1.5.3) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 Found AVX2 Found AVX Found FMA Found SSE4.1 Found OpenMP 201511
代码部署
添加依赖包,可在 http://tess4j.sourceforge.net/ 下载。
github代码:https://github.com/jiangxd0716/ocr