LEADTOOLS Forms (Leadtools.Forms.Recognition assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
CompareForm(FormRecognitionAttributes,FormRecognitionAttributes,FormProgressCallback) Method
See Also 
Leadtools.Forms.Recognition Namespace > FormRecognitionEngine Class > CompareForm Method : CompareForm(FormRecognitionAttributes,FormRecognitionAttributes,FormProgressCallback) Method



masterAttributes
The Master Form attribute object.
formAttributes
The Form attribute object.
callback
Status on the progress of the comparison. Set it to null to ignore progress.

The CompareForm(FormRecognitionAttributes,FormRecognitionAttributes,FormProgressCallback) Method is available as an add-on to the LEADTOOLS Document and Medical Imaging toolkits.

masterAttributes
The Master Form attribute object.
formAttributes
The Form attribute object.
callback
Status on the progress of the comparison. Set it to null to ignore progress.
Returns a FormRecognitionResult object that describes how close the specified Form is to the specified Master Form.

Syntax

Visual Basic (Declaration) 
Overloads Public Function CompareForm( _
   ByVal masterAttributes As FormRecognitionAttributes, _
   ByVal formAttributes As FormRecognitionAttributes, _
   ByVal callback As FormProgressCallback _
) As FormRecognitionResult
Visual Basic (Usage)Copy Code
Dim instance As FormRecognitionEngine
Dim masterAttributes As FormRecognitionAttributes
Dim formAttributes As FormRecognitionAttributes
Dim callback As FormProgressCallback
Dim value As FormRecognitionResult
 
value = instance.CompareForm(masterAttributes, formAttributes, callback)

Parameters

masterAttributes
The Master Form attribute object.
formAttributes
The Form attribute object.
callback
Status on the progress of the comparison. Set it to null to ignore progress.

Example

For a complete example of using form recognition and processing, refer to the FormRecognitionEngine example.

This example compares a Master Form with a Form.

Visual BasicCopy Code
'''This method compares a Form to a Master Form using all pages.
Private Function CompareForm(ByVal recognitionEngine As FormRecognitionEngine, ByVal master As FormRecognitionAttributes, ByVal form As FormRecognitionAttributes) As FormRecognitionResult
   Return recognitionEngine.CompareForm(master, form, Nothing)
End Function
C#Copy Code
///This method compares a Form to a Master Form using all pages.
FormRecognitionResult CompareForm(FormRecognitionEngine recognitionEngine, FormRecognitionAttributes master, FormRecognitionAttributes form)
{
   return recognitionEngine.CompareForm(master, form, null);
}

Remarks

The Master Form and the Form must have the same number of pages. If they do not, the result will be zero and the reason will be .InvalidNumberOfPages.

If the number of pages of the Form is unknown (such as when a scanner is loaded with different forms), use the FormRecognitionEngine.ComparePage method to compare it with the first page of each Master Form. Then use the FormRecognitionEngine.GetFormProperties method to get the number of pages in the Master Form. Next, update the Form attribute object with the required pages if needed for processing.

Comparisons should be made between two attribute sets that were generated using the same Default Manager Objects. For example if the Master Form attribute object was generated using the .BarcodeManager and the Form attribute object was generated using the OcrManager, then the Form will not be recognized since the Master Form attributes do not have the text features of the Form.

In order to recognize a Form, the Form attributes must be compared with all Master Forms attributes that represent the different types of form templates. The Form type is the type of the Master Form attribute object that has generated the highest confidence value. If the highest confidence value is very low that means the Form is not one the types of the Master Forms (i.e. the type of this Form is not defined in the Master Forms set)

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.Forms requires a Forms Module license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features