Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction | Help Version 19.0.7.12
|
Magnetic Ink Character Recognition(MICR) is one of the supported fill methods in both LEADTOOLS Professional and Advantage OCR engines. MICR is used to describe the special numbers and symbols you typically see at the bottom of checks, along with the technology and processes to produce and analyze these characters.
You can recognize MICR fonts using any of the LEADTOOLS OCR engines mentioned above by setting the OcrZone.FillMethod to OcrZoneFillMethod.Micr and then recognizing 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: Start up the engine
' Use the default parameters
ocrEngine.Startup(Nothing, Nothing, Nothing, "C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime")
' *** Step 3: Create an OCR document
Dim ocrDocument As IOcrDocument = ocrEngine.DocumentManager.CreateDocument()
' Add the TIF image that contains the 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 a 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 using 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: Start up the engine
// Use the default parameters
ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime");
// *** Step 3: Create an OCR document
IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument();
// Add the TIF image that contains the 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 a 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 using any of the supported formats instead
ocrDocument.Dispose();
// *** Step 6: Shut down the OCR engine when finished
ocrEngine.Dispose();