Tesseract OCR Engine
Svetlin Nakov and Veselin Kolev
BASD (Bulgarian Association of Software Developers)
Hot News!
• Microsoft Corporation just announced its
strategic partnership with OpenFest
• OpenFest is upgrading to Windows 7 and
MS SQL Server 2008
What is OCR?
• Stands for Optical Character Recognition
• Extracts the text from a given image
What is OCR? (2)
• Invented by Gustav Tauschek
• Tauschek obtained a patent on OCR
• 1929 in Germany
• 1935 in USA
• Tauschek’s machine
• Was a mechanical device
• Uses templates, light and photodetector
• When a light was directed towards the
templates no light reach the photodetector
What is OCR? (3)
• OCR Predicates electronic computers!
Project Tesseract
• History of Tesseract
• Open source OCR engine
• Developed by HP between 1985 and 1995
• Never used in an HP product
• Rated highly at The Fourth Annual Test of
OCR Accuracy in 1995
• In 2005 HP transferred Tesseract to the ISRI
and released it as open source
• ISRI == Information Science Research Institute
• The development is currently led by Google
Project Tesseract (2)
• Tesseract is an OCR Engine and is NOT
a complete OCR program
• Originally intended to serve as a
component part of other programs
• Works from the command line
• Has no page layout analysis (will have
• Has no output formatting
• Has no GUI
Tesseract Versions
• Stable build – version 2.04
• Has some documentation
• Can be easily trained on a new language
• Has memory leaks
• Development version – 3.0 (unstable)
• Not documented, unstable
• Language files are not compatible (need
special conversion)
Downloading, Compiling
and Running Tesseract
(Latest Version)
How Tesseract Works?
1. Adaptive thresholding on the input image
2. Analyze connected components in the binary
3. Find text lines and words
4. First pass of recognition process
Attempts to recognize each word in turn
5. Satisfactory words are passed to adaptive trainer
6. Lessons learned are employed in a second pass
Used for words not satisfactory recognized
7. Producing the output text
Training Tesseract
1. Prepare training images and .box files
Files: lang.tif and lang.box
2.04 supports only uncompressed TIFFs
.box files contain characters with coordinates
2. Extract the character features
tesseract lang.tif junk nobatch box.train
This produces lang.tr
3. Perform character clustering
mftraining lang.tr
cntraining lang.tr
Training Tesseract (2)
4. Compute the character set properties
isLetter, isDigit, isUpper, isPunctuation, …
unicharset_extractor lang.box
Unicode provides this information
5. Train language dictionaries
List of all words in the target language
List of the most frequent words
wordlist2dawg freq-words.txt lang.freq-dawg
wordlist2dawg all-words.txt lang.word-dawg
Training Tesseract for
Bulgarian and English
(Bulgarian for IT Professionals)
Other OCR Engines
• OCRopus
• Open source document analysis and
OCR system
• Also funded by Google
• Provides much of the layout analysis
functionality missing from Tesseract
• Capable to use engines other than
• http://code.google.com/p/ocropus/
Other OCR Engines (2)
• ABBYY FineReader OCR
• Supports a big number of features
• Known for its highly accuracy
• Commercial
• Microsoft Office Document Imaging (MODI)
• Supports editing documents scanned by
Microsoft Office Document Scanning
• It was firstly introduced in MS Office XP
• Commercial
Commercial OCR vs. Tesseract
• 100+ languages
• 6 languages
• Accuracy is good
• Accuracy was good in
• Sophisticated app
with complex UI
• No UI yet
• Works on complex
magazine pages
• Page layout analysis
coming soon
• Windows mostly
• Running on Linux,
Mac, Windows, more..
• Costs $130-$500
• Open source – Free!
Tesseract Future
• Page layout analysis
• More languages
• Improve accuracy
• Add a UI
• Support for connected scripts (like
• For more information see:
• http://code.google.com/p/tesseract-ocr/
• http://en.wikipedia.org/wiki/Optical_characte
• http://tesseract-ocr.repairfaq.org/
• Speakers
• http://nakov.com/blog
• http://veskokolev.blogspot.com
Tesseract OCR

Presentation - Svetlin Nakov