tesseract5.0 交叉编译移植到arm
作者:互联网
公司 最近需要做个手持的ocr识别设备 最终选择了tesseract做为ocr识别引擎
具体编译步骤如下:
1 编译leptonica
1)下载leptonica(http://www.leptonica.org/)版本1.74.4
下载zlib (http://www.zlib.net/)版本1.2.11
下载jpeg (http://www.ijg.org/)版本v9
2)设置交叉编译工具路径
export PATH=/home/work/quick/nano_neo/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin:$PATH
3)编译zlib
a) 指定交叉编译工具
export CC=aarch64-linux-gnu-gcc
b) 进入到zlib目录 执行./configure 配置安装路径
./configure --shared --prefix="/home/work/quick/nano_neo/install/h5/zlib"
c) make and make install
4)编译jpeg
a) 进入到jpeg目录 执行./configure配置相关参数
./configure --host=arm-linux CC=aarch64-linux-gnu-gcc --enable-shared --enable-static --prefix="/home/work/quick/nano_neo/install/h5/jpeg"
b) 执行make and make install
5)编译leptonica
a)指定zlib和jpeg的pkgconfig目录
export PKG_CONFIG_PATH=/home/work/quick/nano_neo/install/h5/zlib/lib/pkgconfig:/home/work/quick/nano_neo/install/h5/jpeg/lib/pkgconfig:$PKG_CONFIG_PATH
b)指定zlib和jpeg的库目录
export ZLIB_LIBS=/home/work/quick/nano_neo/install/h5/zlib/lib
export JPEG_LIBS=/home/work/quick/nano_neo/install/h5/jpeg/lib
c)指定zlib和jpeg连接选型
export LDFLAGS="-L/home/work/quick/nano_neo/install/h5/zlib/lib -L/home/work/quick/nano_neo/install/h5/jpeg/lib"
export LIBS="-ljpeg -lz"
d)执行config 配置 我没有使用libpng 如果需要可以自行编译
./configure --host=arm-linux --without-libpng CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ --prefix="/home/work/quick/nano_neo/install/h5/leptonica"
e)执行make and make install
2 编译 tesseract
1)下载最新tesseract(5.1)
git clone https://github.com/tesseract-ocr/tessdata.git tesseract-ocr.tessdata
2)执行./autogen.sh
3)将zlib 和jpeg的所有库文件和leptonica放到同一个目录
4)指定leptonica pkgconfig目录
export PKG_CONFIG_PATH=/home/work/quick/nano_neo/install/h5/leptonica/lib/pkgconfig:$PKG_CONFIG_PATH
5)执行configure配置 生成makefile
./configure --host=arm-linux CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ --prefix="/home/work/quick/nano_neo/install/h5/tesseract"
6)执行make and make install
标签:neo,zlib,tesseract5.0,work,编译,install,quick,home,arm 来源: https://blog.csdn.net/qq_16454313/article/details/89489426