Results Property
Summary
Returns a dictionary representing the results of processing the MRTD document.
Syntax
C#
Objective-C
C++/CLI
Java
Python
@property (nonatomic, strong, readonly, nullable) NSDictionary<NSNumber *, LTMRTDDataElement *> *results; // LTMRTDField
public:
property Dictionary<MRTDField,MRTDDataElement^>^ Results {
Dictionary<MRTDField,MRTDDataElement^>^ get();
}
Property Value
Dictionary containing the results of processing an MRTD document.
Example
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:\LEADTOOLS23\Resources\Images";
public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS23\Bin\Common\OcrLEADRuntime";
}
import java.io.File;
import java.io.IOException;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
import leadtools.*;
import leadtools.codecs.*;
import leadtools.forms.commands.BankCheckMicrFontType;
import leadtools.forms.commands.BankCheckReader;
import leadtools.forms.commands.MRTDErrors;
import leadtools.forms.commands.MRTDReader;
import leadtools.forms.commands.ProcessListener;
import leadtools.forms.commands.ProcessState;
import leadtools.forms.commands.ProgressEvent;
import leadtools.ocr.OcrEngine;
import leadtools.ocr.OcrEngineManager;
import leadtools.ocr.OcrEngineType;
public void TestMRTDReader() {
RasterCodecs codecs = new RasterCodecs();
MRTDReader mrtdReader = new MRTDReader();
// The MRTD image
String LEAD_VARS_ImagesDir = "C:\\LEADTOOLS23\\Resources\\Images";
String mrtdPath = combine(LEAD_VARS_ImagesDir, "MRZ_SAMPLE.jpg");
RasterImage image = codecs.load(mrtdPath);
String LEAD_VARS_OcrLEADRuntimeDir = "C:\\LEADTOOLS23\\Bin\\Common\\OcrLEADRuntime";
OcrEngine ocrEngine = OcrEngineManager.createEngine(OcrEngineType.LEAD);
ocrEngine.startup(codecs, null, null, LEAD_VARS_OcrLEADRuntimeDir);
assertTrue("OCR engine not started", ocrEngine.isStarted());
// Assign Engine to Reader
mrtdReader.setOcrEngine(ocrEngine);
// Process Image
mrtdReader.processImage(image);
if (mrtdReader.getErrors() == MRTDErrors.NO_ERROR.getValue()) {
for (var value : mrtdReader.getResults().values()) {
System.out.println(String.format("Data Element Field: %s", value));
System.out.println(String.format("Data Element Value: %s", value.getReadableValue()));
System.out.println(String.format("Data Element Code : %s", value.getMrzCharacters()));
System.out.println(String.format("Data Element Valid: %s", value.isValid()));
System.out.println("************************************");
}
}
ocrEngine.shutdown();
}