Magnetic Ink Character Recognition(MICR) is one of the supported fill methods in LEADTOOLS LEAD engine. 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 NativeOcrZoneFillMethod.Micr and then recognizing your page.
The following example shows how to recognize MICR zones:
// Assuming you already added the correct references and the
// following using statements at the beginning of your class:
// using Leadtools;
// using Leadtools.Ocr;
// *** Step 1: Start an OCR engine
// We will use the LEADTOOLS OCR Module - LEAD Engine
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD);
ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime");
// *** Step 2: Load the TIF image that contains the MICR document to be recognized
string imageFile = @"C:\LEADTOOLS22\Resources\Images\MICR_SAMPLE.tif";
RasterImage image = ocrEngine.RasterCodecsInstance.Load(imageFile, 1);
// *** Step 3: Create an OCR page from this image
IOcrPage ocrPage = ocrEngine.CreatePage(image, OcrImageSharingMode.AutoDispose);
LeadRect micrLocation;
// *** Step 4: Add an OCR MICR zone around the MICR font area
// Either set the location manually if known. For example, this is for MICR_SAMPLE.tif:
// micrLocation = new LeadRect(38, 678, 1655, 87);
// Or use the MICRCodeDetectionCommand to automaitcally detect the location
Leadtools.ImageProcessing.Core.MICRCodeDetectionCommand micrCodeDetection = new Leadtools.ImageProcessing.Core.MICRCodeDetectionCommand();
micrCodeDetection.Run(image);
micrLocation = micrCodeDetection.MICRZone;
int zoneIndex = 0;
OcrZone zone = new OcrZone();
zone.Bounds = micrLocation;
zone.ZoneType = OcrZoneType.Micr;
ocrPage.Zones.Add(zone);
// *** Step 5: Recognize
ocrPage.Recognize(null);
// *** Step 6: Get the results as text
string text = ocrPage.GetText(zoneIndex);
Console.WriteLine("The MICR characters recognized on this check are:");
Console.WriteLine(text);
// Optionally, you can use the OcrMicrData helper class to parse the MICR data:
OcrMicrData micrData = ocrPage.GetRecognizedCharacters()[0].ExtractMicrData();
Console.WriteLine("Parsed MICR data:");
Console.WriteLine("Auxiliary:" + micrData.Auxiliary);
Console.WriteLine("EPC:" + micrData.Epc);
Console.WriteLine("Routing:" + micrData.Routing);
Console.WriteLine("Account:" + micrData.Account);
Console.WriteLine("CheckNumber:" + micrData.CheckNumber);
Console.WriteLine("Amount:" + micrData.Amount);
// Alternatively you can create an IOcrDocument and add the page to it to save it to
// any of the supported formats instead
// *** Step 7: Clean up
ocrPage.Dispose();
ocrEngine.Dispose();
Leadtools.Ocr Getting Started (Guide to Example Programs)
Programming with LEADTOOLS .NET OCR
Creating an OCR Engine Instance
Starting and Shutting Down the OCR Engine
OCR Spell Language Dictionaries
OCR Languages and Spell Checking
OCR Tutorial - Working with Pages
OCR Tutorial - Recognizing Pages
OCR Tutorial - Adding and Painting Zones
OCR Tutorial - Working with Recognition Results
OCR Tutorial - Scanning to Searchable PDF
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document