Tesseract

Revision as of 11:53, 3 October 2019 by Ke0etz (Talk | contribs)

Tesseract is capable of taking images of many different formats like jpg, png, tiff, etc and extracting text from it. Tessereact is considered one of the best OCR tools and was developed by Hewlett Packard in C and C++ in 1985 and has been improved constantly since that time.

You will likely require the convert tool from imagemagick to be successful in using tesseract.


installation and basic usage

To install Tesseract OCR on linux mint:

sudo apt install tesseract-ocr

which automatically does this for you: apt install tesseract-ocr-eng

Syntax:

tesseract imagename outputbase [-1 lang] [-psm pagesegmode] [configfile...]

To process a PDF file and output OCR'd text to the screen

tesseract document.png stdout

To process a PDF file and output OCR'd text to a text file

tesseract document.png document.txt

This will not directly accept PDF in the fashion as described above.

Sometimes tesseract works better if the image is bigger, sharper, or has higher contract. Using a combination of imagemagick and tesseract we can get a more accurate OCR text file.

convert -colorspace gray -fill white -resize 480% -sharpen 0x1 documentpage01.png documentpage01.jpg tesseract documentpage01.jpg documentpage01.txt

graphical front end

gImageReader is a simple GTK+ front-end to tesseract-ocr.

sudo apt install gimagereader

searchable PDF using Tesseract

Using the command line the process of turning a non-searchable PDF such as one created by the process described in Create PDF Documents with ImageMagick and Ghostscript into a searchable PDF will be described here. It is possible, but a little complicated.

tesseract document01.png out PDF
tesseract document02.png out PDF
tesseract document03.png out PDF

Page 1, Page 2, and Page 3 all made out to searchable PDF. However, we want them all in one PDF

 

Contributeduck176.gif
Note: This page is notably incomplete. You can help. Please contribute by registering your email address and adding your knowledge to this page. The D.U.C.K. wiki was created to be a free informative place that allows an open exchange of accurate information.
Learn more...

Tesseract does a lot and also preforms better when tweeked using a process of 'training' which in comparison to what is covered here and what we would like to have documented, this page is a sparse entry.

Last modified on 3 October 2019, at 11:53