一、开源路径(github位置)
Tesseract Open Source OCR Engine (main repository) ,下载到本地,查看各操作系统下的使用方法。
二、Mac 下的使用
1、按照文档说明,执行./autogen.sh 发现本地报错:
./autogen.sh: line 60: aclocal: command not found
Something went wrong, bailing out!
2、需要先安装autoconf and automake。(不报错的请略过)
3、继续执行./autogen.sh,后边还是报错:
checking for leptonica... configure: error: leptonica not found
4、安装leptonica:
curl -O http://www.leptonica.org/source/leptonica-1.71.tar.gz
tar -zxvf leptonica-1.71.tar.gz
./configure
make
make install
5、继续执行./autogen.sh,执行通过。
6、再执行:
./configure --with-extra-libraries=/opt/local/lib
7、报错:
checking for l_generateCIDataForPdf in -llept... no
configure: error: leptonica library with pdf support (>= 1.71) is missing
8、重新下载1.73编译安装(如步骤4)。
如果make install报如下错,
install: /usr/local/include/leptonica/allheaders.h: Permission denied
make[2]: *** [install-pkgincludeHEADERS] Error 71
make[1]: *** [install-am] Error 2
make: *** [install-recursive] Error 1
改用root用户执行(sudo make install),OK。
9、重新执行。
./autogen.sh
./configure --with-extra-libraries=/usr/local/lib
执行完成,但是有警告,
You can not build training tools because of missing dependency.
Check configure output for details.
往上翻翻看日志:
configure: WARNING: Training tools WILL NOT be built because of missing icu library.
configure: WARNING: Try to install libicu-devel package.
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for pango... no
configure: WARNING: Training tools WILL NOT be built because of missing pango library.
configure: WARNING: Try to install libpango1.0-dev package.
checking for cairo... no
configure: WARNING: Training tools WILL NOT be built because of missing cairo library.
configure: WARNING: Try to install libcairo-dev?? package.
10、先忽略警告,直接编译安装。
make
sudo make install
11、执行完成,安装成功。
whatlookingfor:tesseract-master root# make install
Making install in ccutil
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
test -z "/usr/local/include/tesseract" || ../config/install-sh -c -d "/usr/local/include/tesseract"
/usr/bin/install -c -m 644 basedir.h errcode.h fileerr.h genericvector.h helpers.h host.h memry.h ndminx.h params.h ocrclass.h platform.h serialis.h strngs.h tesscallback.h unichar.h unicharmap.h unicharset.h '/usr/local/include/tesseract'
Making install in viewer
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
make[2]: Nothing to be done for `install-data-am'.
Making install in cutil
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
make[2]: Nothing to be done for `install-data-am'.
Making install in opencl
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
make[2]: Nothing to be done for `install-data-am'.
Making install in ccstruct
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
test -z "/usr/local/include/tesseract" || ../config/install-sh -c -d "/usr/local/include/tesseract"
/usr/bin/install -c -m 644 publictypes.h '/usr/local/include/tesseract'
Making install in dict
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
make[2]: Nothing to be done for `install-data-am'.
Making install in classify
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
make[2]: Nothing to be done for `install-data-am'.
Making install in wordrec
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
make[2]: Nothing to be done for `install-data-am'.
Making install in textord
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
make[2]: Nothing to be done for `install-data-am'.
Making install in neural_networks/runtime
test -z "/usr/local/lib" || ../../config/install-sh -c -d "/usr/local/lib"
make[2]: Nothing to be done for `install-data-am'.
Making install in cube
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
make[2]: Nothing to be done for `install-data-am'.
Making install in ccmain
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
test -z "/usr/local/include/tesseract" || ../config/install-sh -c -d "/usr/local/include/tesseract"
/usr/bin/install -c -m 644 thresholder.h ltrresultiterator.h pageiterator.h resultiterator.h osdetect.h '/usr/local/include/tesseract'
Making install in api
test -z "/usr/local/lib" || ../config/install-sh -c -d "/usr/local/lib"
/bin/sh ../libtool --mode=install /usr/bin/install -c libtesseract.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libtesseract.3.dylib /usr/local/lib/libtesseract.3.dylib
libtool: install: (cd /usr/local/lib && { ln -s -f libtesseract.3.dylib libtesseract.dylib || { rm -f libtesseract.dylib && ln -s libtesseract.3.dylib libtesseract.dylib; }; })
libtool: install: /usr/bin/install -c .libs/libtesseract.lai /usr/local/lib/libtesseract.la
libtool: install: /usr/bin/install -c .libs/libtesseract.a /usr/local/lib/libtesseract.a
libtool: install: chmod 644 /usr/local/lib/libtesseract.a
libtool: install: ranlib /usr/local/lib/libtesseract.a
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
test -z "/usr/local/bin" || ../config/install-sh -c -d "/usr/local/bin"
/bin/sh ../libtool --mode=install /usr/bin/install -c tesseract '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/tesseract /usr/local/bin/tesseract
test -z "/usr/local/include/tesseract" || ../config/install-sh -c -d "/usr/local/include/tesseract"
/usr/bin/install -c -m 644 apitypes.h baseapi.h capi.h renderer.h '/usr/local/include/tesseract'
Making install in .
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/lib/pkgconfig" || config/install-sh -c -d "/usr/local/lib/pkgconfig"
/usr/bin/install -c -m 644 tesseract.pc '/usr/local/lib/pkgconfig'
Making install in tessdata
Making install in configs
make[3]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/tessdata/configs" || ../../config/install-sh -c -d "/usr/local/share/tessdata/configs"
/usr/bin/install -c -m 644 inter makebox box.train unlv ambigs.train api_config kannada box.train.stderr quiet logfile digits hocr tsv linebox pdf rebox strokewidth bigram txt '/usr/local/share/tessdata/configs'
Making install in tessconfigs
make[3]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/tessdata/tessconfigs" || ../../config/install-sh -c -d "/usr/local/share/tessdata/tessconfigs"
/usr/bin/install -c -m 644 batch batch.nochop nobatch matdemo segdemo msdemo '/usr/local/share/tessdata/tessconfigs'
make[3]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/tessdata" || ../config/install-sh -c -d "/usr/local/share/tessdata"
/usr/bin/install -c -m 644 pdf.ttf '/usr/local/share/tessdata'
Making install in doc
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/share/man/man1" || ../config/install-sh -c -d "/usr/local/share/man/man1"
/usr/bin/install -c -m 644 cntraining.1 combine_tessdata.1 mftraining.1 tesseract.1 unicharset_extractor.1 wordlist2dawg.1 ambiguous_words.1 shapeclustering.1 dawg2wordlist.1 '/usr/local/share/man/man1'
test -z "/usr/local/share/man/man5" || ../config/install-sh -c -d "/usr/local/share/man/man5"
/usr/bin/install -c -m 644 unicharambigs.5 unicharset.5 '/usr/local/share/man/man5'
whatlookingfor:tesseract-master root#