centos下安装tessrect-ocr及训练工具问题分析及解决办法
最近要在服务器上搭建tessrect-ocr和训练工具,搭建一个训练网页:
http://115.159.205.168/ocr_php/public/index.php
在搭建中遇到了以下问题:
1.找不到tessrect-ocr安装包
2.训练工具无法安装
1.解决办法:
sudo yum install tesseract.i686
2.安装centos库时,没有安装训练工具,所以要进行源码安装:
1.下载源码:
wget https://github.com/tesseract-ocr/tesseract/archive/master.zip
2.解压:
unzip tesseract-master.zip
3.运行以下命令:
./autogen.sh
./configure
make
sudo make install
sudo ldconfig
现在已经安装好引擎了,现在安装训练工具:
make training
sudo make training-install
但是如果你的程序在./configure时显示这个:
Configuration is done.
You can now build and install tesseract by running:
$ make
$ sudo make install
You can not build training tools because of missing dependency.
Check configure output for details.
那训练工具肯定安装不成功,因为它没有生产Makefile文件
configure: creating ./config.status
config.status: creating Makefile
config.status: creating tesseract.pc
config.status: creating api/Makefile
config.status: creating ccmain/Makefile
config.status: creating opencl/Makefile
config.status: creating ccstruct/Makefile
config.status: creating ccutil/Makefile
config.status: creating classify/Makefile
config.status: creating cube/Makefile
config.status: creating cutil/Makefile
config.status: creating dict/Makefile
config.status: creating neural_networks/runtime/Makefile
config.status: creating textord/Makefile
config.status: creating viewer/Makefile
config.status: creating wordrec/Makefile
config.status: creating tessdata/Makefile
config.status: creating tessdata/configs/Makefile
config.status: creating tessdata/tessconfigs/Makefile
config.status: creating testing/Makefile
config.status: creating java/Makefile
config.status: creating java/com/Makefile
config.status: creating java/com/google/Makefile
config.status: creating java/com/google/scrollview/Makefile
config.status: creating java/com/google/scrollview/events/Makefile
config.status: creating java/com/google/scrollview/ui/Makefile
config.status: creating doc/Makefile
config.status: creating config_auto.h
config.status: config_auto.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
很明显,没有产生training的Makefile文件
下面解决办法:
1.去看./configure产生的信息:
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... no
checking whether #! works in shell scripts... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for getline... yes
checking for wchar_t... yes
checking for long long int... yes
checking for off_t... yes
checking for mbstate_t... yes
checking for leptonica... yes
checking for l_generateCIDataForPdf in -llept... yes
checking leptonica headers version >= 1.71... yes
checking unicode/uchar.h usability... yes
checking unicode/uchar.h presence... yes
checking for unicode/uchar.h... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for pango... yes
checking for cairo... yes
如果有Warning:...............can't install training tools 按照其提示未安装的进行按照:
如果找不到包,执行以下命令:
yum list | gerp name
找到对应包。
这里有一个包ICU版本比较旧,要进行源码安装:
1.下载源码:
wget http://download.icu-project.org/files/icu4c/58.1/icu4c-58_1-src.tgz
2. 安装
./configure
make
sudo make install
然后重新运行./configure
如果没有Warning但仍然显示无法安装:
修改config.status文件,325行添加 training/Makefile
然后进入training目录,
执行
make
make install