←Select platform

RecognitionMethod Property

Summary
Specifies which recognition Method to use for forms recognition.

Syntax
C#
C++/CLI
Java
Python
public FormsRecognitionMethod RecognitionMethod { get; set; } 
public FormsRecognitionMethod getRecognitionMethod(); 
public void setRecognitionMethod( 
   FormsRecognitionMethod formsRecognitionMethod 
); 
public: 
property FormsRecognitionMethod RecognitionMethod { 
   FormsRecognitionMethod get(); 
   void set (    FormsRecognitionMethod ); 
} 
RecognitionMethod # get and set (FormRecognitionOptions) 

Property Value

The Leadtools.Forms.Common.FormsRecognitionMethod Method for forms recognition.

Remarks

Using Simple method Simple has less progress time than Complex but may fail in recognize some forms.

Example

This example adds a page image to an attributes and use Fast compare to find match.

C#
Java
using Leadtools.Forms.Common; 
using Leadtools.Forms.Recognition; 
using Leadtools.Codecs; 
 
///This method will pass  attributes to recognize form. 
public FormRecognitionResult CompareFormsWithMastersFast(RasterImage filledFormImage, List<FormRecognitionAttributes> mastersAttributes, FormRecognitionEngine engine) 
{ 
   FormRecognitionOptions formOptions = new FormRecognitionOptions(); 
   // We will use Simple (fast) method to create form to use it with CompareFormFast  method 
   formOptions.RecognitionMethod = FormsRecognitionMethod.Simple; 
   FormRecognitionAttributes filledAttribute = engine.CreateForm(formOptions); 
   PageRecognitionOptions pageOptions = new PageRecognitionOptions(); 
   pageOptions.AutoCleanUp = true; 
   pageOptions.UpdateImage = true; 
 
   engine.AddFormPage(filledAttribute, filledFormImage, pageOptions); 
   engine.CloseForm(filledAttribute); 
 
   filledAttribute.Image = filledFormImage; 
 
   return engine.CompareFormFast(mastersAttributes, filledAttribute, null); 
} 
 
import static org.junit.Assert.assertTrue; 
 
import java.io.File; 
import java.io.IOException; 
import java.util.ArrayList; 
import java.util.UUID; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
 
import leadtools.*; 
import leadtools.codecs.RasterCodecs; 
import leadtools.forms.common.*; 
import leadtools.forms.recognition.*; 
 
 
public void compareFormsWithMastersFastExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   RasterImage filledFormImage = new RasterCodecs().load(combine(LEAD_VARS_IMAGES_DIR, "ocr1.tif")); 
 
   FormRecognitionEngine engine = new FormRecognitionEngine(); 
   FormRecognitionAttributes fra = engine.createMasterForm("master form 1", UUID.randomUUID(), null); 
   ArrayList<FormRecognitionAttributes> mastersAttributes = new ArrayList<FormRecognitionAttributes>(); 
   mastersAttributes.add(fra); 
 
   FormRecognitionOptions formOptions = new FormRecognitionOptions(); 
 
   // We will use Simple (fast) method to create form to use it with 
   // CompareFormFast method 
   formOptions.setRecognitionMethod(FormsRecognitionMethod.SIMPLE); 
   assertTrue(formOptions.getRecognitionMethod() == FormsRecognitionMethod.SIMPLE); 
   FormRecognitionAttributes filledAttribute = engine.createForm(formOptions); 
   PageRecognitionOptions pageOptions = new PageRecognitionOptions(); 
   pageOptions.setAutoCleanUp(true); 
   assertTrue(pageOptions.getAutoCleanUp() == true); 
   pageOptions.setUpdateImage(true); 
   assertTrue(pageOptions.getUpdateImage() == true); 
 
   engine.addFormPage(filledAttribute, filledFormImage, pageOptions); 
   engine.closeForm(filledAttribute); 
 
   filledAttribute.setImage(filledFormImage); 
 
   FormRecognitionResult result = engine.compareFormFast(mastersAttributes, filledAttribute, null); 
   assertTrue(result != null); 
   System.out.println("Confidence value: " + result.getConfidence()); 
} 
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.Recognition Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.