OCR: Extract text from Image

Anonymous picture Anonymous · Aug 31, 2016 · Viewed 8k times · Source

I am working on the program to extract text from the image. For that I tried with Tessaract and Ocropus libraries and I am able to convert simple plain text (black and white with simple font) from image to text string. For example:

Example of image 1

But I am not able to extract texts from complex image. Let's say for example from this image:

Example of image 2

Does anyone know how to achieve this? Is there any library available for extract text from complex images (with unpredictable different backgrounds? I will prefer Python, but language is not a bar.

Answer

Dmitry Torba picture Dmitry Torba · Aug 31, 2016

How all this word recognition work is machine learning algorithm is fed a lot of images with already interpreted corresponding text. It learns to understand letters from different fonts and appearances it is given.

However, logos are made with very specific font. Almost no two logos use similar one. That makes it very hard, if not impossible, to create a learning data to recognize what is written.

That is possible to train algorithm to recognize Sprite trademark everywhere it sees it. For that, you'd need to use OpenCV and train it on Sprite logos of different qualities, pictures of logos of Sprite on stores, bottles, etc. That way, it will be able to see this particular logo (you also will need a dataset of non-Sprite logos, like Coke logo or picture of something completely irrelevant, like cat).

The reasons humans, unlike computers, can learn to recognize these things is because human brain is so much more powerful that the neural network you can create to understand that kind of things in computer. When computers will be as powerful as humans are in terms of computational capacity, re-ask this question and you will receive automatic answer from human-like machine.