←Select platform

MasterFormLoadType Property

Summary

Specifies how to load in memory the master form data found in the repository.

Syntax
C#
C++/CLI
Java
Python
public AutoFormsEngineMasterFormLoadType MasterFormLoadType { get; } 
public AutoFormsEngineMasterFormLoadType getMasterFormLoadType(); 
public:  
   property AutoFormsEngineMasterFormLoadType^ MasterFormLoadType 
   { 
      AutoFormsEngineMasterFormLoadType^ get() 
   } 
MasterFormLoadType # get  (AutoFormsEngine) 

Property Value

Gets the load type for master form data.

Remarks

This property is used to control the amount of memory used to hold master form data while maintaining the AutoFormsEngine's speed. The AutoFormsEngine performs the fastest when all master form data are loaded in memory. If the repository contains too many master forms to be loaded in memory, then there are two options:

  1. Load MasterForm data on demand.
  2. Use cache. Cache is a tradeoff between AutoFormsEngine speed and the needed memory. Notice that the cache option works only when FullTextSearchManager is set, otherwise it will work as in the load on demand option.
Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Forms.Auto; 
using Leadtools.Document; 
using Leadtools.Ocr; 
using Leadtools.Forms.Recognition; 
using Leadtools.Forms.Processing; 
using Leadtools.Barcode; 
 
using Leadtools.Forms; 
 
public static void AutoFormsEngineCreateOptions_Example() 
{ 
   using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)) 
   { 
      ocrEngine.Startup(null, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
 
      string root = Path.Combine(LEAD_VARS.ImagesDir, @"Forms\MasterForm Sets\Driving License"); 
      DiskMasterFormsRepository formsRepository = new DiskMasterFormsRepository(ocrEngine.RasterCodecsInstance, root); 
 
      // Set the parameters for the AutoFormsEngine 
      AutoFormsEngineCreateOptions autoFormsOptions = new AutoFormsEngineCreateOptions() 
      { 
         Repository = formsRepository, 
         RecognitionOcrEngine = ocrEngine, 
         ProcessingOcrEngine = ocrEngine, 
         BarcodeEngine = null, 
         Managers = AutoFormsRecognitionManager.Ocr | AutoFormsRecognitionManager.Default, 
         MinimumConfidenceKnownForm = 30, 
         MinimumConfidenceRecognized = 80, 
         RecognizeFirstPageOnly = true, 
         MasterFormLoadType = AutoFormsEngineMasterFormLoadType.UseCache 
      }; 
 
      // Create the AutoFormsEngine using the options previously defined 
      using (AutoFormsEngine autoEngine = new AutoFormsEngine(autoFormsOptions)) 
      { 
         // If caching masterform files, load 10 of them at a time 
         if (autoEngine.MasterFormLoadType == AutoFormsEngineMasterFormLoadType.UseCache) 
            autoEngine.MasterFormCacheMaximumSize = 10; 
 
         // Recognize and process the form 
         autoEngine.FilledFormType = FormsPageType.IDCard; 
         autoEngine.EnableQuickPreRecognitionCheck = false; 
         AutoFormsRunResult result = autoEngine.Run(Path.Combine(LEAD_VARS.ImagesDir, @"Forms\Forms to be Recognized\Driving License\License.png"), null); 
 
         if (result != null) 
            Console.WriteLine(String.Format("Recognized as {0} with {1}% confidence.", result.RecognitionResult.MasterForm.Name, result.RecognitionResult.Result.Confidence)); 
         else 
            Console.WriteLine("Form not recognized"); 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
   public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS23\Bin\Common\OcrLEADRuntime"; 
} 
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.