Install and use Tesseract-OCR Ubuntu

Source: Internet
Author: User
Tesseract-OCR is an open-source optical character recognition engine that supports Google and supports recognition in many languages. The following describes how to install it.

In fact, the official document details the commands listed below,

sudo apt-get install autoconf automake libtoolsudo apt-get install libpng12-devsudo apt-get install libjpeg62-devsudo apt-get install libtiff4-devsudo apt-get install zlib1g-dev

Note that 1g in the last zlib1g-dev is the number 1, not the lowercase letter l,

sudo apt-get install libleptonica-dev

Download the source file package and decompress it (currently 3.0) to enter the directory.

./runautoconf./configuremakesudo make install

Download language package decompress: you can find more language packs here

gzip -d eng.traineddata.gz

Move to the package installation directory. The default value is/usr/local/share/tessdata.

mv eng.traineddata /usr/local/share/tessdataexport TESSDATA_PREFIX=/usr/local/share/

Install the image format conversion tool because tesseract only recognizes images in Tif format.

apt-get install imagemagick

You can use the following command to convert the image

convert a.jpg a.tif

Okay. Test it.

tesseract <image> <outputbasename> [-l lang] [configs]tesseract a.tif a

The default value is English. To identify other languages, use the-l parameter, as shown in figure

tesseract a.tif a -l chi_simcat a.txt

You will see the recognized text, which is amazing. Now, we can use a program to call the recognition text,

For Java, you can also use the API encapsulated by tess4j. For PHP, you can use exec to call and process the file,

If lib **. So cannot be found, run

sudo ldconfig

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.