依賴
安裝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