I would like to perform OCR on this sample image.

enter image description here

TextRecognize[Import["RedBox.jpg"], Language -> "German"]


statt 1 5.80
1 3 I
(per 0,5 Liter 0 69)

which is unsatisfactory. Can I do any better with Mathematica 10, e.g. by adding extra pre-processing steps? (I did not see any further options for parameterizing TextRecognize itself.)

BTW, I've also tried Tesseract at Free OCR and it also runs into problems of its own:

statt 15.80
1 (  Li.terO.69)
  • 3
    $\begingroup$ Do you intend to do text recognition on several tags exactly formated like this one? If so, trimming it into smaller sections and post processing the recognition results (composing it back together) can be of interest. Training a Classify on some of the portions of your image can eventually also help... $\endgroup$ – P. Fonseca Nov 14 '14 at 22:09
  • $\begingroup$ @P.Fonseca Thx for your reply. If I can help it, I would prefer not to introduce assumptions about the inner geometry of the box. I've meanwhile noticed that e.g. prior black-and-white conversion with ColorSeparate[image, "HSB"][[2]] helps (a bit), so I'm still optimistic. $\endgroup$ – Drux Nov 14 '14 at 22:21
  • $\begingroup$ Just by curious. Is this a real World problem? If yes, do you more sample tags? Do you need all the label texts? $\endgroup$ – Murta Nov 15 '14 at 2:19
  • $\begingroup$ @Murta The answer to both questions is yes. (Extracting the promoted price, e.g. 13.80 €, is most important.) Perhaps it is possible to first split the image into boxes with similar-sized letters and do separate OCR on each. $\endgroup$ – Drux Nov 15 '14 at 6:13
  • $\begingroup$ this is an old post, but I just want to mention that in version 11 of Mathematica Textrecognize does a perfect job on your example. It seems folks at Wolfram have been working in the meantime. $\endgroup$ – M. Stern Oct 28 '17 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.