-
Notifications
You must be signed in to change notification settings - Fork 9.6k
FAQ
A collection of frequently asked questions and the answers, or pointers to them for Tesseract 4.0.0. Common errors and information for their resolution is given on a separate wiki page.
For the older version of the FAQ pertaining to Tesseract 2.0x, 3.0x and 4.00.00alpha, please see FAQ Old.
If you have a question which is not answered by the FAQ, Wiki pages and Issues, please search in the users mailing-list/forum before posting it there.
If you think you found a bug in Tesseract, please search existing issues. If you find an existing similar issue, please add to it, otherwise create a new issue.
Read the CONTRIBUTING guide before you report an issue in GitHub or ask a question in the forum.
(Please note, this page is currently being updated for 4.0.0).
See Tesseract Wiki Home page for details.
See Tesseract man page for the list of languages and scripts supported by Tesseract4.0.0.
See the Tesseract Wiki Data Files page for information regarding the three different types of language models available for Tesseract 4.0.0.
User contributed language models are linked from Data Files Contributions.
The files should be installed in /usr/share/tesseract-ocr/4.00/tessdata (on Ubuntu).
If you get an error message saying eng.traineddata not found, try setting
TESSDATA_PREFIX=/usr/share/tesseract-ocr/4.00/tessdata
and all will be good.
- txt
- hocr
- tsv
- pdf with text layer only
Tesseract's standard output is a plain txt file (utf-8 encoded, with '\n' as end-of-line marker) and 'FF' as a form feed character after each page.
With the configfile 'pdf' tesseract will produce searchable PDF containing pages images with a hidden, searchable text layer.
With the configfile 'hocr' tesseract will produce XHTML output compliant with the hOCR specification (the input image name must be ASCII if the operating system use something other than utf-8 encoding for filenames - see issue 809 for some details).
With the configfile 'tsv' tesseract will produce tab-separated values file.
tesseract -c textonly_pdf=1
will produce a text-only PDF which can be merged with an images-only PDF. See issue 660 for related discussion and utility for merging the PDFs.
See Tesseract Wiki Command Line Usage page for information on how to run Tesseract from the command line.
tesseract --help
will provide the most recent help information for the installed version.
Prepare a text file that has the path to each image:
path/to/1.png
path/to/2.png
path/to/3.tiff
Save it, and then give its name as input file to Tesseract.
tesseract savedlist output
Each page will be terminated by the FF character by default for text output.
Setting page_separator
to the LF character would restore the old behaviour of adding an empty line at the end of each page.
Setting page_separator
to an empty string would omit page separators.
See Tesseract Wiki API examples page for sample programs for using the API.
You should note that in many cases, in order to get better OCR results, you'll need to improve the quality of the input image you are giving Tesseract.
If you are running Tesseract 4, you can use the "fast" integer models.
Tesseract 4 also uses up to four CPU threads while processing a page, so it will be faster than Tesseract 3 for a single page.
If your computer has only two CPU cores, then running four threads will slow down things significantly and it would be better to use a single thread or maybe a maximum of two threads! Using a single thread eliminates the computation overhead of multithreading and is also the best solution for processing lots of images by running one Tesseract process per CPU core.
Set the maximum number of threads using the environment variable OMP_THREAD_LIMIT
.
To disable multithreading, use OMP_THREAD_LIMIT=1
.
Tesseract can be trained to recognize other languages or finetune existing language models. See Tesseract Wiki Training Tesseract 4.00 page for information on training the LSTM engine.
Please note that currently LSTM training is only supported using synthetic images created using a UTF-8 training text and unicode fonts to render the text.
There are inconsistent results from tesseract when the same TessBaseAPI object is used for decoding multiple images
Try to turn off the adaptive classifier by setting the config variable classify_enable_learning
to 0
, or to clear the adaptive data with the method ClearAdaptiveClassifier()
.
See also the discussion on the tesseract forum
To restore the old behaviour of writing to tesseract.log instead of writing to the console window, you need a text file that contains this:
debug_file tesseract.log
call the file 'logfile' and put it in tessdata/configs/ Then add logfile to the end of your command line.
See issue 579. On linux you can redirect stderr and stdout output to /dev/null. E.g.:
tesseract phototest.tif phototest 1>/dev/null 2>&1
With tesseract 3.02 you can use config "quiet". E.g.:
tesseract phototest.tif phototest quiet
Warning: Both options will cause you to not see the error message if there is one.
Searchable PDF output is a standard feature as of Tesseract version 3.03. Use the pdf
config file like this:
tesseract phototest.tif phototest pdf
There may be nothing wrong with the PDF itself, but its hidden, searchable text layer may be not understood by your PDF reader. For example, Preview.app in Mac OS X is well known for having problems like this, and might "see" only spaces and no text. Try using Adobe Acrobat Reader instead.
Let's say you have an amazing but slow multipage scanning device. It would be nice to OCR during scanning. In this example, the scanning program is sending image filenames to Tesseract as they are produced. Tesseract streams a searchable PDF to stdout.
scanimage --batch --batch-print | tesseract -c stream_filelist=true - - pdf > output.pdf
You can, but it won't work very well, as Tesseract is designed for printed text. Take a look at the Lipi Toolkit project instead.
No. Tesseract is for text recognition.
You're looking at it. If things aren't clear, search on the Tesseract Google Group or ask us there. If you want to help us write more, please do, and post it to the group!
Periodically stable versions go to the downloads page. Between releases, and in particular, just before a new release, the latest code is available from git. You can find the source here: /~https://github.com/tesseract-ocr/tesseract.git where you can check it out either by command line, or by following the link to the howto on using various client programs and plugins.
If you want to have several version of tesseract (e.g. you want to compare OCR result) I would suggest you to compile them from source (e.g. in /usr/src) and not install them. If you want to test particular version you can run it this way:
/usr/src/tesseract-3.03/api/tesseract eurotext.tif eurotext
/usr/src/tesseract-ocr.3.02/api/tesseract eurotext.tif eurotext
/usr/src/tesseract-3.03/api/tesseract is shell wrapper script, and it will take care that correct shared library is used (without installation...).
Try searching the forum: http://groups.google.com/group/tesseract-ocr as well as open and closed issues on GitHub: /~https://github.com/tesseract-ocr/tesseract/issues, as your question may have come up before even if it is not listed here.
Old wiki - no longer maintained. The pages were moved, see the new documentation.
These wiki pages are no longer maintained.
All pages were moved to tesseract-ocr/tessdoc.
The latest documentation is available at https://tesseract-ocr.github.io/.