This is a creation in Article, where the information may have evolved or changed.
Environment:
OS X EI Capitian Version 10.11.6
Installation steps refer to:
Https://github.com/GeertJohan/go.tesseract/tree/v1
$ brew install leptonica$ brew install tesseract$ export CGO_LDFLAGS="-L/usr/local/Cellar/leptonica/1.72/lib -L/usr/local/Cellar/tesseract/3.04.01_1/lib"$ export CGO_CFLAGS="-I/usr/local/Cellar/leptonica/1.72/include -I/usr/local/Cellar/tesseract/3.04.01_1/include"
To perform the second step of the Times wrong:
Error:you must ' brew link libpng jpeg libtiff leptonica ' before tesseract can be installed
The wrong thing to say is: You need to do this before installing Tesseract: Brew link libpng jpeg libtiff leptonica
Decisive copy, paste, enter, a three-even recruit ...
Vomiting Blood ~ reported the following error:
Yilizhao:lib zhaoyili$ Brew link libpng jpeg libtiff leptonica
Linking/usr/local/cellar/libpng/1.6.23 ...
Error:could not symlink lib/libpng.a
/usr/local/lib is not writable.
See the wrong meaning is:/usr/local/lib You this directory is not allowed to write
Then let it be written:
sudo chmod -R 777 /usr/local/lib
Go on:
brew link libpng jpeg libtiff leptonica
Pass!
Go on:
brew install tesseract
Pass!!
Execute the last two shells
$ export CGO_LDFLAGS="-L/usr/local/Cellar/leptonica/1.72/lib -L/usr/local/Cellar/tesseract/3.04.01_1/lib"$ export CGO_CFLAGS="-I/usr/local/Cellar/leptonica/1.72/include -I/usr/local/Cellar/tesseract/3.04.01_1/include"
Note: I installed this version of Tesseract3.04.01, leptonica1.72, perhaps you installed this version of the change, here remember to use the CD command to see if there is. and change the path of the shell above to normal.
The above installation is basically complete.
Try it out:
tesseract idcard.jpg result// 带中文数据包的tesseract -l chi_sim idcard.jpg result // 权识别数字tesseract -l chi_sim idcard.jpg result digits
will automatically identify and convert the 123.jpg to a TXT file to Result.txt
Continued:
Since I want to do an auxiliary bank card number input or ID input, and tesseract recognition is required language data packet, so, I downloaded the Chinese Simplified packet:
Https://github.com/tesseract-ocr/tessdata/blob/master/chi_sim.traineddata
So, where should this file be put?
Mine is in this directory:
/usr/local/cellar/tesseract/3.04.01_1/share/tessdata
Number of packets:
/usr/local/cellar/tesseract/3.04.01_1/share/tessdata/configs/digits