Master form load options
public enum AutoFormsEngineMasterFormLoadType
public final class AutoFormsEngineMasterFormLoadType
extends java.lang.Enum<AutoFormsEngineMasterFormLoadType>
Public Enum AutoFormsEngineMasterFormLoadType
public:
enum class AutoFormsEngineMasterFormLoadType sealed
Value | Member | Description |
---|---|---|
0 | LoadAllInMemory | Load to memory all master forms found in a repository |
1 | LoadOnDemand | Load master form on demand, i.e., one at a time. |
2 | UseCache | Use cache to store loaded master forms. |
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms.Common;
using Leadtools.Forms.Auto;
using Leadtools.Ocr;
using Leadtools.Forms.Recognition;
using Leadtools.Forms.Processing;
using Leadtools.Barcode;
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:\LEADTOOLS21\Resources\Images";
public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS21\Bin\Common\OcrLEADRuntime";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Forms.Common
Imports Leadtools.Forms.Auto
Imports Leadtools.Ocr
Imports Leadtools.Forms.Recognition
Imports Leadtools.Forms.Processing
Imports Leadtools.Barcode
Public Shared Sub AutoFormsEngineCreateOptions_Example()
Using ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)
ocrEngine.Startup(Nothing, Nothing, Nothing, LEAD_VARS.OcrLEADRuntimeDir)
Dim root As String = Path.Combine(LEAD_VARS.ImagesDir, "Forms\MasterForm Sets\Driving License")
Dim formsRepository As DiskMasterFormsRepository = New DiskMasterFormsRepository(ocrEngine.RasterCodecsInstance, root)
' Set the parameters for the AutoFormsEngine
Dim autoFormsOptions As AutoFormsEngineCreateOptions = New AutoFormsEngineCreateOptions()
autoFormsOptions.Repository = formsRepository
autoFormsOptions.RecognitionOcrEngine = ocrEngine
autoFormsOptions.ProcessingOcrEngine = ocrEngine
autoFormsOptions.BarcodeEngine = Nothing
autoFormsOptions.Managers = AutoFormsRecognitionManager.Ocr Or AutoFormsRecognitionManager.Default
autoFormsOptions.MinimumConfidenceKnownForm = 30
autoFormsOptions.MinimumConfidenceRecognized = 80
autoFormsOptions.RecognizeFirstPageOnly = True
autoFormsOptions.MasterFormLoadType = AutoFormsEngineMasterFormLoadType.UseCache
' Create the AutoFormsEngine using the options previously defined
Using autoEngine As AutoFormsEngine = New AutoFormsEngine(autoFormsOptions)
' If caching masterform files, load 10 of them at a time
If autoEngine.MasterFormLoadType = AutoFormsEngineMasterFormLoadType.UseCache Then
autoEngine.MasterFormCacheMaximumSize = 10
End If
' Recognize and process the form
autoEngine.FilledFormType = FormsPageType.IDCard
autoEngine.EnableQuickPreRecognitionCheck = False
Dim result As AutoFormsRunResult = autoEngine.Run(Path.Combine(LEAD_VARS.ImagesDir, "Forms\Forms to be Recognized\Driving License\License.png"), Nothing)
If Not result Is Nothing Then
Console.WriteLine(String.Format("Recognized as {0} with {1}% confidence.", result.RecognitionResult.MasterForm.Name, result.RecognitionResult.Result.Confidence))
Else
Console.WriteLine("Form not recognized")
End If
End Using
End Using
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"
Public Const OcrLEADRuntimeDir As String = "C:\LEADTOOLS21\Bin\Common\OcrLEADRuntime"
End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.