←Select platform

CreateRecognitionOcrEngine Method

Summary

Create and startup OCR engine instance suitable for forms recognition.

Syntax
C#
C++/CLI
Java
Python
public static OcrEngine createRecognitionOcrEngine( 
   OcrEngineType,  
   RasterCodecs,  
   DocumentWriter,  
   java.lang.String,  
   java.lang.String 
); 

Parameters

ocrEngineType

OCR engine type. Passed to OcrEngineManager.CreateEngine.

rasterCodecs

Raster codecs instance passed to IOcrEngine.Startup.

documentWriter

Document writer instance passed to IOcrEngine.Startup.

workDirectory

Work directory value passed to IOcrEngine.Startup.

startUpParameters

Startup parameters value passed to IOcrEngine.Startup.

Return Value

An instance of IOcrEngine that started and setup with settings suitable for forms recognition.

Remarks

An instance of IOcrEngine is used during AutoFormsEngine operations. This usage is divided into the following:

Forms recognition: during this phase, OCR speed takes precedence over accuracy to quickly perform the recognition process. An OCR engine setup with the fastest settings should be used. The CreateRecognitionOcrEngine helper method can be used to create this engine.

Forms processing: during this phase, OCR accuracy takes precedence over speed to ensure the form fields data is extracted correctly. An OCR engine setup with the most accurate settings should be used. The CreateProcessingOcrEngine helper method can be used to create this engine.

Typical usage would be to set the values returned from CreateRecognitionOcrEngine and CreateProcessingOcrEngine into the AutoFormsEngineCreateOptions.RecognitionOcrEngine and ProcessingOcrEngine
instance can be used to create the AutoFormsEngine. The following is a code snippet that performs this:

AutoFormsEngineCreateOptions createOptions = new AutoFormsEngineCreateOptions(); 
// Set the OCR engine to be used for recognition 
createOptions.RecognitionOcrEngine = AutoFormsEngine.CreateRecognitionOcrEngine(OcrEngineType.LEAD, null, null, null, ocrLEADRuntimeDir); 
// Set the OCR engine to be used for processing 
createOptions.ProcessingOcrEngine = AutoFormsEngine.CreateProcessingOcrEngine(OcrEngineType.LEAD, null, null, null, ocrLEADRuntimeDir); 
// TODO fill any other creation options as needed, such as the managers, repository and so forth 
// Now, create the Auto Forms engine 
AutoFormsEngine autoFormsEngine = new AutoFormsEngine(createOptions); 
// TODO Use the engine 
// When we are done, dispose the OCR engines used (will not be disposed by AutoFormsEngine) 
autoFormsEngine.ProcessingOcrEngine.Dispose(); 
autoFormsEngine.RecognitionOcrEngine.Dispose(); 
autoFormsEngine.Dispose(); 

Using separate engine for recognition and processing is considered best practice but is optional. The user can set the same OCR engine into both AutoFormsEngineCreateOptions.RecognitionOcrEngine and AutoFormsEngineCreateOptions.ProcessingOcrEngine if required.

The various constructors of AutoFormsEngine that takes a single instance of IOcrEngine will set the same object into both RecognitionOcrEngine and ProcessingOcrEngine and hence use the same OCR engine for recognition and processing.

Requirements

Target Platforms

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

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