7-Segment Display OCR
Asked Answered
W

2

14

I'm building an iOS application (take a picture and run OCR on it) using Tesseract (an OCR library) and it is working very well with well written numbers and characters (using usual fonts).

The problem I am having is that if I try it on a 7-Segment Display, it gives very very bad results.

So my question is: Does anyone know how I can approach this problem? Is there a way for Tesseract to recognize these characters?

Winged answered 20/2, 2012 at 12:35 Comment(1)
The funny thing is that (regardless of this specific package), it is much easier to identify 7 segment characters - simple image processing - edge detection and then finding the lengths and directions brings you halfwayAnthropologist
S
11

I too had great difficulty in getting tesseract to recognize digits from images of LCD displays.

I had some marginal success by preprocessing the images with ImageMagick to overlay a copy of the image on itself with a slight vertical shift to fill in the gaps between segments:

$ composite -compose Multiply -geometry +0+3  foo.tif foo.tif foo2.png

In the end, though, my saving grace was the "Seven Segment Optical Character Recognition" binary: http://www.unix-ag.uni-kl.de/~auerswal/ssocr/

Many thanks to the author, Erik Auerswald, for this code!

Stirpiculture answered 11/5, 2012 at 21:24 Comment(2)
How to run ssocr on iOS?Migraine
How did you use in android?Demisec
N
2

I haven't tried OCRing 7-Segment Display, but I suspect that the problem might be caused by the characters not being connected components. Tesseract does not handle disconnected fonts well from my experience.

Simple erosion (image preprocessing) might help by connecting segments, but you would have to test it and play with kernel size to prevent too much distortion.

Nikolaos answered 20/2, 2012 at 12:49 Comment(2)
Yeah I know that. I tried coloring the pixels myself just to try OCR on the picture (with connected digits) and it still didn't work. Probably because the font is weird, so I'm trying to work on the font. Thx for your answer anw :)Winged
Then, train tesseract using that font. It is probably better to use fonts after conecting segments, but you'd better try both (train using original and the connected fonts) to see which is better.Nikolaos

© 2022 - 2024 — McMap. All rights reserved.