public enum MRTDField
Value | Member | Description |
---|---|---|
0 | Type | The Type of the Document. |
1 | DocumentCode | The Code of the Document. |
2 | DocumentNumber | The Number of the Document. |
3 | PassportNumber | The Number of the Passport. |
4 | IssuingState | The Issuing State of the Document. |
5 | Name | The Name of the Document Holder. |
6 | LastName | The Last name of the Document Holder. |
7 | Sex | The Sex of the Document Holder. |
8 | Nationality | The Nationality of the Document Holder. |
9 | DateOfBirth | The Date Of Birth for the Document Holder. |
10 | DateOfExpiry | The Date Of Expiry for the Document. |
11 | ValidUntilDate | Valid Until Date for the Document. |
12 | OptionalData | The Optional Data for the Document. |
13 | OptionalData2 | The Optional Data for the Document(some documents has two optional Data). |
14 | IDCardNumber | The number of the Identification Card. |
100 | PassportNumberCheckDigit | The Check Digit for Passport number. |
101 | DocumentNumberCheckDigit | The Check Digit for the Document number. |
102 | IDCardNumberCheckDigit | The Check Digit for the Id Card number. |
103 | DateOfBirthCheckDigit | The Check Digit for the Date Of Birth. |
104 | DateOfExpiryCheckDigit | The Check Digit for the Date Of Expiry. |
105 | ValidUntilDateCheckDigit | The Check Digit for the "Valid Until Date" field. |
106 | OptionalDataCheckDigit | The Check Digit for Optional Data. |
107 | CompositeCheckDigit | The Composite Check Digit. |
108 | OverallCheckDigit | The Overall Check Digit. |
MRTDField is used in MRTDDataElement to show the data element related field.
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:\LEADTOOLS22\Resources\Images";
public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime";
}