Install Google Tesseract, ready to write an image-recognition project with Golang

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.