←Select platform

OcrEngine Property

Summary
Gets or sets the IOcrEngine to be used by an MRTDReader to process an image.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public IOcrEngine OcrEngine { get; set; } 
@property (nonatomic, strong, null_unspecified) LTOcrEngine *ocrEngine; 
public OcrEngine getOcrEngine(); 
public void setOcrEngine( 
   OcrEngine ocrEngine 
); 
public: 
property IOcrEngine^ OcrEngine { 
   IOcrEngine^ get(); 
   void set (    IOcrEngine^ ); 
} 
OcrEngine # get and set (MRTDReader) 

Property Value

The IOcrEngine that will be used by the MRTDReader object to process Image.

Example
C#
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"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.4.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 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.