How to recognize MICR codes?

589 views Asked by At

I want to write a c++ program that can be used to scan MICR codes same as -(Android : How to recognize MICR codes). I have used tesseract before to scan texts from a image and it worked fine but it fails miserably and gives me stupid results when i scan MICR codes. I would really appreciate if someone can advise me any links or suggestions on how to scan MICR code in Windows using tesseract or any other library.

Thanks you

1

There are 1 answers

4
anto On

You could use OpenCV to write your own OCR system. It implements the k-nearest neighbor algorithm that could be used to recognize arbitrary characters (characters of the MICR in this case). I did something like this using the Java bindings of OpenCV and it gave me good results.

This post got me started with the idea : https://stackoverflow.com/a/9620295/2644645

edit

Roughly, you could do :

  1. Find a way to extract individual character from you image.
  2. Normalize these characters (for example if the point of view or the distance vary).
  3. Manually create your training set for the k-nearest neighbor algorithm. You should also consider a way to save/load the data (I think OpenCV can do this).
  4. Finally, you can feed unknown characters into the algorithm and it will give you the best match (if k=1) in your training set. Be sure to consider the returned vector dist, as it gives you an idea if it's a good match or not.