←Select platform

ProcessAtOnce Method

Summary

Analyzes input image by detecting, recognizing, and parsing MRZ code.

Syntax

C#
C++/CLI
Python
public MRZReader ProcessAtOnce( 
   RasterImage image, 
   bool ownImage, 
   CancellationToken ct 
) 
public:  
   MRZReader^ ProcessAtOnce( 
      RasterImage^ image, 
      bool ownImage, 
      CancellationToken^ ct 
   ) 
def ProcessAtOnce(self,image,ownImage,ct): 

Parameters

image

A RasterImage reference.

ownImage

A boolean value to indicate whether to use its own image.

ct

A CancellationToken value.

Remarks

This function ignores any feeds received by the Process() function, if any, and takes this frame (passed in the parameter) and uses it as a key frame and will try to parse the MRZ code.

Example

C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Ocr; 
using Leadtools.Forms.Commands; 
 
 
 
public void ProcessAtOnceMRZCode(RasterImage rasterImage) 
{ 
   IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD); 
   ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
 
   if (ocrEngine.SettingManager.IsSettingNameSupported("Recognition.RecognitionModuleTradeoff")) 
      ocrEngine.SettingManager.SetEnumValue("Recognition.RecognitionModuleTradeoff", "Accurate"); 
 
   MRZReader reader = new MRZReader(); 
   reader.MRZReaderOCR(ocrEngine); 
   var results = reader.ProcessAtOnce(rasterImage,true); 
 
   if (reader.Results != null) 
   { 
      foreach (var item in reader.Results) 
      { 
         Console.WriteLine("Field name : " + item.Key.ToString() + "Value : " + item.Value.ToString()); 
      } 
   } 
 
   reader.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   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.assertTrue; 
 
import leadtools.*; 
import leadtools.codecs.RasterCodecs; 
import leadtools.forms.commands.MRZReader; 
import leadtools.ocr.OcrEngine; 
import leadtools.ocr.OcrEngineManager; 
import leadtools.ocr.OcrEngineType; 
 
 
public void MRZReaderProcessAtOnceMRZCodeExample() { 
   final String LEAD_VARS_OCR_LEAD_RUNTIME_DIR = "C:\\LEADTOOLS22\\Bin\\Common\\OcrLEADRuntime"; 
   RasterImage rasterImage = new RasterCodecs().load("C:\\LEADTOOLS22\\Resources\\Images\\mrz_sample.jpg"); 
   OcrEngine ocrEngine = OcrEngineManager.createEngine(OcrEngineType.LEAD); 
   ocrEngine.startup(null, null, null, LEAD_VARS_OCR_LEAD_RUNTIME_DIR); 
   assertTrue("OCR engine failed to start", ocrEngine.isStarted()); 
 
   if (ocrEngine.getSettingManager().isSettingNameSupported("Recognition.RecognitionModuleTradeoff")) 
      ocrEngine.getSettingManager().setEnumValue("Recognition.RecognitionModuleTradeoff", "Accurate"); 
 
   MRZReader reader = new MRZReader(); 
   reader.mrzReaderOCR(ocrEngine); 
   MRZReader results = reader.processAtOnce(rasterImage, true, null); 
 
   if (reader.getResults() != null) 
      for (var item : reader.getResults().entrySet()) 
         System.out.println("Field name : " + item.getKey() + "Value : " + item.getValue()); 
 
   assertTrue("Expected results not found", results != null); 
   System.out.println("Results read successfully"); 
 
   reader.dispose(); 
} 

Requirements

Target Platforms

See Also

MRZReader Class

MRZReader Members

Leadtools.Forms.Commands Namespace

Help Version 23.0.2024.5.23
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms.Commands Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.