Search code examples
text-recognition

Recognize text from an image


Image with text to be recognized

How is it possible to process this image so that text can be recognized. I have tried to convert the image in several ways that can be summarized like this:

converted1=ColorConvert[![\[][1]][1],"Grayscale"]
converted2=TextRecognize[converted1]

But I only get gibberish. These letters are "filled" so they have to be transformed to something that Mathematica can do. The question is how.I would prefer to do it with Mathematica, but I only see posts recommending other tools. Any pointers would be greatly appreciated.


Solution

  • You are trying to do character recognition where the template or font of each character will not change.

    To solve this you can simply use template matching algorithm.

    1) Save all your template images(Characters to be recognized) and their corresponding key as to what each template is representing. (EX: If Template Image has the character 'A', it's key should be given as 'A')

    2) Mathematica has image correlate function. check here. This function takes image and kernel as inputs. So pass every character template to this function. If there is high correlation value, then that particular character is present in the image.

    3)Now use the key value of the template to recognize which character it is.

    4) Finally based on where local maxima or local minima (depending on your template matching algorithm)is present in the image, you will get the location of the character with which you can save all the characters into a grid in a preferred order.

    Check this to learn more about template matching.

    Hope this works!