While I wait for a £1.75 USB LED light to solve my cupboard lumination problem I thought I would investigate digit recognition for an LCD screen.
Turns out some clever people before me have considered the same problem from the point of view of allowing the blind to read displays.
I found some good ideas in this publication – http://www.ski.org/rerc/HShen/Publications/embedded.pdf
And this one: http://ukpmc.ac.uk/articles/PMC3146550/reload=0;jsessionid=MGJB9oCtdMe3ZwipoBs0.0
Turns out the problem can be distinguished from classic OCR and bespoke algorithms provide better success. Both papers have Symbian implementations and so look perfect for implementation on the Raspberry Pi. The second publication looks slightly easier for a novice like me.
This leads me to sketch out the following rough process for a C++ program:
- Take PGM file from uvccapture as input
- Read PGM file in c++ – http://stackoverflow.com/questions/8126815/how-to-read-in-data-from-a-pgm-file-in-c
- Then binarize as per algorithm in second article.
- Then recognise blobs as per Wikipedia pseudo code for connected component analysis – http://en.wikipedia.org/wiki/Connected-component_labeling
- Then filter (e.g. By size h/w ration).
- Then detect digits (look up Hough voting).
- Then check digits are sensible.
- Output a short or byte number reading (e.g. 4.4).
There may be scope for adding in edge detection (as per first publication) – may be as an extra input for blob detection or filtering. Edge detection in Linux : http://linux.about.com/library/cmd/blcmdl1_pgmedge.htm .
This Thesis also has some useful ideas about using the OpenCV resource: http://repositories.tdl.org/ttu-ir/bitstream/handle/2346/ETD-TTU-2011-05-1485/LI-THESIS.pdf?sequence=1 (although I don’t think Tesseract would work very well – and it hasn’t been ported to the Pi as far as I am aware). However, for now loading 3GB of code (for OpenCV) may be overkill for my task.
3 thoughts on “Digit Recognition for an LCD Screen”
Did you get any further with this project? it's very similiar to what I am starting to work on right now (buying an interrface card for 800 Euro? Not with me, when 50 Euro Equipment and some work are sufficient, too.)Any advice/solutions you can share?
Just started up again – was writing some code in C++ but came across SimpleCV and prototyped in no time. SimpleCV provides an adaptive threshold binarisation routine that gives good results on LCDs. I then locate lines to give me the frame of the LCD display and crop that.I then recognise blobs within this cropped image – dilating/eroding to join the individual digit portions.I can then extract each digit and save.I am working on classification – the classifiers that come with SimpleCV are not working – some Orange integration issue.I will try to post an update sometime soon.