←Select platform

FormDropoutColor Class

Summary

Contains the thresholds obtained from the Master Form used to apply color drop out on the recognized form.

Syntax

C#
C++/CLI
Python
public class FormDropoutColor 
public: 
   ref class FormDropoutColor 
class FormDropoutColor: 

Remarks

To apply color drop out is to specify a color to be removed from the form when processing it.

Example

C#
using Leadtools; 
using Leadtools.Barcode; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Ocr; 
using Leadtools.Forms.Processing; 
using Leadtools.Forms.Recognition; 
using Leadtools.Forms.Recognition.Barcode; 
using Leadtools.Forms.Recognition.Ocr; 
using Leadtools.Document; 
 
public void ProcessLEADDoc() 
{ 
   string masterAtt = Path.Combine(LEAD_VARS.ImagesDir, @"Forms\MasterForm Sets\OCR\FFC-107.bin"); 
   string masterFields = Path.Combine(LEAD_VARS.ImagesDir, @"Forms\MasterForm Sets\OCR\FFC-107.xml"); 
 
   RasterCodecs codecs = new RasterCodecs(); 
 
   FormProcessingEngine processingEngine = new FormProcessingEngine(); 
   FormRecognitionEngine recognitionEngine = new FormRecognitionEngine(); 
   FormRecognitionAttributes attributes = recognitionEngine.CreateForm(null); 
   FormRecognitionAttributes masterAttributes = new FormRecognitionAttributes(); 
 
   // Set Master Form Data from file and load fields 
   masterAttributes.SetData(File.ReadAllBytes(masterAtt)); 
   processingEngine.LoadFields(masterFields); 
 
   // Dropout any green pixels in the page 
   FormDropoutColor dropColor = new FormDropoutColor(0, 20, 0, 0, 230, 0); 
   processingEngine.Pages[0].DropoutColors.AddDropoutColor(dropColor); 
 
   using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)) 
   { 
      ocrEngine.Startup(codecs, null, null, LEAD_VARS.OcrLEADRuntimeDir); 
      OcrObjectsManager objectsManager = new OcrObjectsManager(ocrEngine); 
      objectsManager.Engine = ocrEngine; 
 
      recognitionEngine.ObjectsManagers.Add(objectsManager); 
 
      // Load the LEADDocument from file with default options 
      LoadDocumentOptions loadOptions = new LoadDocumentOptions(); 
      LEADDocument leadDoc = DocumentFactory.LoadFromFile(Path.Combine(LEAD_VARS.ImagesDir, @"Forms\Filled Forms\FCC-107_OCR_Filled.tif"), loadOptions); 
 
      // Add the lead document to the attributes object to compare 
      recognitionEngine.OpenForm(attributes); 
      recognitionEngine.AddFormPage(0, attributes, leadDoc, null, null); 
      recognitionEngine.CloseForm(attributes); 
 
      // Compare master attributes with form attributes 
      FormRecognitionResult recognitionResult = recognitionEngine.CompareForm(masterAttributes, attributes, null); 
      if (recognitionResult.PageResults.Count == 0) 
      { 
         Console.WriteLine("Pages count is 0."); 
         return; 
      } 
 
      Console.WriteLine("LEADDoc recognized with confidence of {recognitionResult.PageResults[0].Confidence}\n"); 
 
      List<PageAlignment> pageAlignments = new List<PageAlignment>(); 
      pageAlignments.Add(recognitionResult.PageResults[0].Alignment); 
 
      processingEngine.OcrEngine = ocrEngine; 
      // Process first page  
      processingEngine.Process(leadDoc, 0, 0, pageAlignments); 
 
      leadDoc.Dispose(); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
   public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS22\Bin\Common\OcrLEADRuntime"; 
} 

Requirements

Target Platforms

See Also

FormDropoutColor Members

Leadtools.Forms.Processing Namespace

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

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