Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find parameters supported in Tesseract OCR config file

Tags:

tesseract

I want to know what parameters the config file used by Tesseract OCR accepts, how to write a config file, etc.

I can't find any documentation about this on their site. How can I determine what parameters are supported, and what they mean?

like image 770
sashoalm Avatar asked Oct 22 '12 08:10

sashoalm


People also ask

What is conf in Tesseract?

A Tesseract config file is just a plain text file containing space-delimited key/value pairs for Tesseract config variables, each on separate line. There are several standard config files in the tessdata/configs folder of a standard Tesseract installation.

What is OEM and PSM in Tesseract?

The --oem argument, or OCR Engine Mode, controls the type of algorithm used by Tesseract. The --psm controls the automatic Page Segmentation Mode used by Tesseract.

What is Outputbase in Tesseract?

Simplest Invocation to OCR an image tesseract imagename outputbase. This uses English as the default language and 3 as the Page Segmentation Mode. The default output format is text. osd. traineddata, for Orientation and Segmentation and eng.

What is Tesseract PSM?

You can think of the --psm 0 mode as a “meta information” mode where Tesseract provides you with just the script and rotation of the input image — when applying this mode, Tesseract does not OCR the actual text and return it for you.


3 Answers

I found these instructions in the link below. They are about writing the config file and where to place it:

config file is simple text file without BOM and with Unix end-of-line mark (on Windows you can use some advanced text editor e.g. Notepad++ to achieve this).

If you use tesseract executable this is only way how to change tesseract parameters.

config file should be located in your tessdata/configs directory. Have a look there for some examples.

There is a list of all the variables plus descriptions of each one in http://www.sk-spell.sk.cx/tesseract-ocr-parameters-in-302-version. Note it's for Tesseract 3.02, things may be different in other versions.

Edit: Also adding a pastebin link in case the above link becomes dead.

like image 114
sashoalm Avatar answered Oct 01 '22 00:10

sashoalm


Tesseract v3.04 now offers the command line option --print-parameters, so you can call tesseract --print-parameters to get a list of the 678 (!) configurable parameters, their default values, and a short description:

Tesseract parameters:
editor_image_xpos   590 Editor image X Pos
editor_image_ypos   10  Editor image Y Pos
editor_image_menuheight 50  Add to image height for menu bar
editor_image_word_bb_color  7   Word bounding box colour
editor_image_blob_bb_color  4   Blob bounding box colour
editor_image_text_color 2   Correct text colour
...and many, many more
like image 28
chbrown Avatar answered Oct 01 '22 00:10

chbrown


It's just a plain text file containing space-delimited key/value pairs for Tesseract config variables, each on separate line; for instance:

interactive_display_mode T
tessedit_display_outwords T

There are several standard config files -- such as digits, hocr -- under Tesseract tessdata/configs folder.

like image 29
nguyenq Avatar answered Oct 01 '22 02:10

nguyenq