Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tesseract confuses two numbers

Tags:

ocr

tesseract

I'm writing an application to scan numbers from an image.

The numbers are using the OCR-B font and may also contain + and > characters.

This is my source image:

source image

The scans using Tesseract weren't very good, even when limiting the character set to the mentioned characters. As I didn't find any OCRB training files for Tesseract, I decided to train it myself.

I created this training image and made a box file from it. The box file is correct, all letters are matched correctly.

Then I did all steps described here to create the other necessary files.

Using this newly trained OCR-B tessdata-set, I get pretty good results on the source image, with one little bug: All 1s are mistaken for 8s and vice-versa. The command used to process the image was

$ tesseract esr2c.tif ocrb-esr2c -l ocrb

and the output for the source image was

0800000001456>8 00000195731208 8 01050008 023+ 08 0301226>20

If you swap all 1s and 8s and compare it to the source image, the output would be correct (except for the last two letters which I can ignore).

How could this happen? Did I do some mistake in the training process? How can I fix it?

like image 462
Danilo Bargen Avatar asked Sep 03 '11 12:09

Danilo Bargen


People also ask

Can Tesseract read numbers?

We find that Tesseract managed to extract numbers in 4,049 out of 5,000 frames.

How accurate is Tesseract?

Combinations of the first three preprocessing actions are said to boost the accuracy of Tesseract 4.0 from 70.2% to 92.9%.

How many languages can Tesseract detect?

In fact, Tesseract supports over 100 languages, including those that comprise characters and symbols, as well as right-to-left languages.


2 Answers

It's likely that somewhere in your box file has incorrect values (characters) for 1 and 8. You can verify using jTessBoxEditor program. If so, correct, regenerate the language data file, and try again.

like image 50
nguyenq Avatar answered Sep 30 '22 20:09

nguyenq


I have trained tesseract 2.04 after 1 month efforts for OCR A extended font. Its working very well and showing above 90 Accuracy with font size 14.

Training image should be high Contrast image. Use "GIMP" image editor and do following Menu Colors->Info->Histgram- Read Std Deviation value colors-> Threshould -> Write "Std Deviation value" as Threshould value Save image Use it for training.

Check and edit your box file using "qt-box-editor-1.06.exe".It is very easy to use. Check All boxes and characters in it. It is very important. Somewhere in your box file has incorrect characters for 1 and 8.

Run other cmds.

like image 40
yogeshjoshicolor Avatar answered Sep 30 '22 20:09

yogeshjoshicolor