Is there any way to read micr font characters from cheques using tesseract ocr or anyother package for python?
<p>When i used the pytesseract for character recognition on cheques, the micr characters are not getting recognized properly.</p>

<p>You will need to use the MICR language file in order to properly recognize the MICR characters. See this post:</p>

<p><a href="http://stackoverflow.com/questions/25279271/android-how-to-recognize-micr-codes">Android : How to recognize MICR codes</a></p>

<p>Excerpt from post: </p>

<blockquote>
  <p>You can use Tesseract with mcr.traineddata language data file.</p>
</blockquote>

<p>or you can use this Github project: <a href="https://github.com/BigPino67/Tesseract-MICR-OCR" rel="nofollow">Tesseract MICR OCR</a></p>

<p>If you are not opposed to calling .NET libraries in Python, another option is to use a 3rd party commercial library that support MICR fonts as well as other languages and characters. The <a href="https://www.leadtools.com/corporate/press/2015/leadtools-micr-sdk-becomes-go-to-solution-for-check-recognition" rel="nofollow">LEADTOOLS SDK has MICR</a> support that's very easy to use. Please note that I am an employee of this product. Also included is <a href="https://www.leadtools.com/help/leadtools/v19/dh/po/leadtools.imageprocessing.core~leadtools.imageprocessing.core.micrcodedetectioncommand.html" rel="nofollow">an image processing function</a> that will automatically detect and find where the MICR is, so you do not have to have any manual input.</p>

<p>To call .NET functions from Python, you can check out this post:</p>

<p><a href="http://stackoverflow.com/questions/7367976/calling-a-c-sharp-library-from-python">Calling a C# library from python</a></p>

<p>Here is an example of extracting the MICR field from a check using one of the OCR demos:</p>

<p><a href="http://i.stack.imgur.com/DT13i.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/DT13i.jpg" alt="enter image description here"></a></p>

<p>Here is a .NET C# method that will load a file and auto-detect the MICR zone and OCR it then return the results using LEADTOOLS:</p>

<pre><code>  private string DetectandRecognizeMICR(string fileName)
  {
     string micr = "";
     //Initialize the codecs class and load the image
     using (RasterCodecs codecs = new RasterCodecs())
     {
        using (RasterImage img = codecs.Load(fileName))
        {
           //prepare the MICR detector command and run it
           MICRCodeDetectionCommand micrDetector = new MICRCodeDetectionCommand();
           micrDetector.SearchingZone = new LeadRect(0, 0, img.Width, img.Height);
           micrDetector.Run(img);

           //See if there is a MICR detected - if not return
           if (micrDetector.MICRZone == LeadRect.Empty)
              return "No MICR detected in this file.";

           //if there is a MICR zone detected startup OCR
           using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
           {
              ocrEngine.Startup(null, null, null, null);

              //create the OCR Page
              IOcrPage ocrPage = ocrEngine.CreatePage(img, OcrImageSharingMode.None);

              //Create the OCR zone for the MICR and add to the Ocr Page and recognize
              OcrZone micrZone = new OcrZone();
              micrZone.Bounds = LogicalRectangle.FromRectangle(micrDetector.MICRZone);
              micrZone.ZoneType = OcrZoneType.Micr;
              ocrPage.Zones.Add(micrZone);
              ocrPage.Recognize(null);

              //return the MICR text
              micr = ocrPage.GetText(-1);
           }
        }
     }
    return micr;
   }
</code></pre>

python ocr tesseract python-tesseract