Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
MICR - Magnetic Ink Character Recognition

MICR is one of the supported fill methods in all LEADTOOLS Plus, Professional and Advantage OCR engines, and it stand for Magnetic Ink Character Recognition and is used to describe the special numbers and symbols you typically see at the bottom of checks, and the technology and processes to produce and analyze these characters.

You can recognize MICR fonts using any of LEADTOOLS OCR engines mentioned above by setting the OcrZone.FillMethod to OcrZoneFillMethod.Micr then recognize your page.

The following example shows how to recognize MICR zones:

[Visual Basic]


' Assuming you already added the correct references and the
' following Imports statements at the beginning of your class:
' Imports Leadtools.Forms
' Imports Leadtools.Forms.Ocr
' Imports Leadtools.Forms.DocumentWriters

' *** Step 1: Select the engine type and create an instance of the IOcrEngine interface.

' We will use the LEADTOOLS OCR Advantage engine
Dim ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, False)

' *** Step 2: Startup the engine

' Use the default parameters
ocrEngine.Startup(Nothing, Nothing, Nothing, Nothing)

' *** Step 3: Create an OCR document

Dim ocrDocument As IOcrDocument = ocrEngine.DocumentManager.CreateDocument()

' Add the TIF image that contains MICR document to be recognized
' MICR_SAMPLE.tif ships with your LEADTOOLS installation
Dim ocrPage as IOcrPage = ocrDocument.Pages.AddPage("C:\Users\Public\Documents\LEADTOOLS Images\MICR_SAMPLE.tif", Nothing)

' *** Step 4: Add manual zone around the MICR font area for the loaded image
Dim zone As OcrZone = New OcrZone()
zone.Bounds = New LogicalRectangle(38, 678, 1655, 87, LogicalUnit.Pixel)
zone.FillMethod = OcrZoneFillMethod.Micr
zone.RecognitionModule = OcrZoneRecognitionModule.Auto
zone.ZoneType = OcrZoneType.Text
ocrPage.Zones.Add(zone)

' *** Step 5: Recognize as text
Dim text As String = ocrPage.RecognizeText(Nothing)
Console.WriteLine("The MICR characters recognized on this check are:")
Console.WriteLine(text)

' Alternatively you can call ocrPage.Recognize and ocrDocument.Save to save to a
' disk file with any of the supported formats instead

ocrDocument.Dispose()

' *** Step 6: Shut down the OCR engine when finished
ocrEngine.Dispose()

[C#]


// Assuming you already added the correct references and the
// following using statements at the beginning of your class:
// using Leadtools.Forms;
// using Leadtools.Forms.Ocr;
// using Leadtools.Forms.DocumentWriters;

// *** Step 1: Select the engine type and create an instance of the IOcrEngine interface.

' We will use the LEADTOOLS OCR Advantage engine
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false);

// *** Step 2: Startup the engine

// Use the default parameters
ocrEngine.Startup(null, null, null, null);

// *** Step 3: Create an OCR document

IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument();

// Add the TIF image that contains MICR document to be recognized
// MICR_SAMPLE.tif ships with your LEADTOOLS installation
IOcrPage ocrPage = ocrDocument.Pages.AddPage(@"C:\Users\Public\Documents\LEADTOOLS Images\MICR_SAMPLE.tif", null);

// *** Step 4: Add manual zone around the MICR font area for the loaded image
OcrZone zone = new OcrZone();
zone.Bounds = new LogicalRectangle(38, 678, 1655, 87, LogicalUnit.Pixel);
zone.FillMethod = OcrZoneFillMethod.Micr;
zone.RecognitionModule = OcrZoneRecognitionModule.Auto;
zone.ZoneType = OcrZoneType.Text;
ocrPage.Zones.Add(zone);

// *** Step 5: Recognize as text
string text = ocrPage.RecognizeText(null);
Console.WriteLine("The MICR characters recognized on this check are:");
Console.WriteLine(text);

// Alternatively you can call ocrPage.Recognize and ocrDocument.Save to save to a
// disk file with any of the supported formats instead

ocrDocument.Dispose();

// *** Step 6: Shut down the OCR engine when finished
ocrEngine.Dispose();

See Also