Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tesseract Trained data

Tags:

Am trying to extract data from reciepts and bills using Tessaract , am using tesseract 3.02 version .

am using only english data , Still the output accuracy is about 60%.

Is there any trained data available which i just replace in tessdata folder

like image 878
nicky Avatar asked Aug 26 '12 17:08

nicky


People also ask

Can we train Tesseract?

Luckily, you can train your Tesseract so it can read your font easily.

Is Tesseract pre trained?

Tesseract pre-trained models You can download the pre-created ones designed to be fast and consume less memory, as well as the ones requiring more in terms of resources but giving a better accuracy.

What is Tesseract data?

Tesseract is an open source text recognition (OCR) Engine, available under the Apache 2.0 license. It can be used directly, or (for programmers) using an API to extract printed text from images. It supports a wide variety of languages.


1 Answers

This is the image nicky provided as a "typical example file":

typical example file

Looking at it I'd clearly say: "Forget it, nicky! You cannot train Tesseract to recognize 100% of text from this type of image!"

However, you could train yourself to make better photos with your iPhone 3GS (that's the device which was used for the example pictures) from such type of receipts. Here are a few tips:

  • Don't use a dark background. Use white instead.
  • Don't let the receipt paper crumble. Straighten it out.
  • Don't place the receipt loosely on an uneven underground. Fix it to a flat surface:
    • Either place it on a white sheet of paper and put a glas platen over it.
    • Or use some glue and glue it flat on a white sheet of paper without any bend-up edges or corners.
  • Don't use a low resolution like just 640x480 pixels (as the example picture has). Use a higher one, such as 1280x960 pixels instead.
  • Don't use standard exposure. Set the camera to use extremely high contrast. You want the letters to be black and the white background to be really white (you don't need the grays in the picture...)
  • Try to make it so that any character of a 10-12 pt font uses about 24-30 pixels in height (that is, make the image to be about 300 dpi for 100% zoom).

That said, something like the following ImageMagick command will probably increase Tesseract's recognition rate by some degree:

convert                               \    http://i.stack.imgur.com/q3Ad4.jpg \   -colorspace gray                    \   -rotate 90                          \   -crop 260x540+110+75 +repage        \   -scale 166%                         \   -normalize                          \   -colors 32                          \    out1 .png 

It produces the following output:

ImageMagick optimization for OCR

You could even add something like -threshold 30% as the last commandline option to above command to get this:

enter image description here

(You should play a bit with some variations to the 30% value to tweak the result... I don't have the time for this.)

like image 173
Kurt Pfeifle Avatar answered Oct 18 '22 21:10

Kurt Pfeifle