public class MRTDReader
Public Class MRTDReader
@interface LTMRTDReader : NSObject
public class MRTDReader
public ref class MRTDReader
This object can be used to process images or strings.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms.Common;
using Leadtools.Ocr;
using Leadtools.Forms.Commands;
public void TestMRTDReader()
{
// Initialize the RasterCodecs class
RasterCodecs codecs = new RasterCodecs();
// Initialize the MRTDReader class
MRTDReader mrtdReader = new MRTDReader();
// The MRTD image
string mrtdPath = Path.Combine(LEAD_VARS.ImagesDir, "MRZ_SAMPLE.jpg");
RasterImage image = codecs.Load(mrtdPath);
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD);
ocrEngine.Startup(codecs, null, null, LEAD_VARS.OcrLEADRuntimeDir);
// Assign Engine to Reader
mrtdReader.OcrEngine = ocrEngine;
// Process Image
mrtdReader.ProcessImage(image);
if (mrtdReader.Errors == MRTDErrors.NoError)
{
foreach (var value in mrtdReader.Results)
{
Console.WriteLine(string.Format("Data Element Field: {0}", value.Key.ToString()));
Console.WriteLine(string.Format("Data Element Value: {0}", value.Value.ReadableValue));
Console.WriteLine(string.Format("Data Element Code : {0}", value.Value.MrzCharacters));
Console.WriteLine(string.Format("Data Element Valid: {0}", value.Value.IsValid.ToString()));
Console.WriteLine("************************************");
}
}
ocrEngine.Shutdown();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";
public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS21\Bin\Common\OcrLEADRuntime";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Forms.Common
Imports Leadtools.Ocr
Imports Leadtools.Forms.Commands
Public Sub TestMRTDReader()
' Initialize the RasterCodecs class
Dim codecs As New RasterCodecs()
' Initialize the BankCheckReader class
Dim mrtdReader As New MRTDReader()
' The bank check image
Dim chequePath As String = Path.Combine(LEAD_VARS.ImagesDir, "MRZ_SAMPLE.jpg")
Dim image As RasterImage = codecs.Load(chequePath)
Using ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)
ocrEngine.Startup(Nothing, Nothing, Nothing, "C:\LEADTOOLS21\Bin\Common\OcrLEADRuntime")
' Assign Engine to Reader
mrtdReader.OcrEngine = ocrEngine
' Process Image
mrtdReader.ProcessImage(image)
If mrtdReader.Errors = MRTDErrors.NoError Then
For Each value As KeyValuePair(Of MRTDField, MRTDDataElement) In mrtdReader.Results
Console.WriteLine(String.Format("Data Element Field: {0}", value.Key.ToString()))
Console.WriteLine(String.Format("Data Element Value: {0}", value.Value.ReadableValue))
Console.WriteLine(String.Format("Data Element Code : {0}", value.Value.MrzCharacters))
Console.WriteLine(String.Format("Data Element Valid: {0}", value.Value.IsValid.ToString()))
Console.WriteLine("************************************")
Next
End If
End Using
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"
End Class
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