Confidence Property
Summary
Gets or sets the level of confidence that a recognition engine has when comparing a Form's attributes object with a Master Form's attributes object.
Syntax
public int Confidence { get; set; }
public int getConfidence();
public void setConfidence(
int intValue
);
public:
property int Confidence {
int get();
void set ( int );
}
Property Value
The confidence number expresses the certainty of the recognition process.
Example
This example finds the maximum confidence of the comparison with Master Forms.
using Leadtools.Forms.Common;
using Leadtools.Forms.Recognition;
///This method identifies the type of the form based on the comparison results.
public int IdentifyForm(FormRecognitionResult[] results)
{
int maxIndex = 0;
maxIndex = 0;
for (int i = 1; i < results.Length; i++)
{
if (results[maxIndex].Confidence < results[i].Confidence)
maxIndex = i;
}
if (results[maxIndex].Confidence < 30)
maxIndex = -1;//no match
return maxIndex;
}
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import org.junit.*;
import org.junit.Test;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import leadtools.forms.recognition.FormRecognitionResult;
public void formRecognitionResultConfidenceExample() {
FormRecognitionResult[] results = createResultArray();
int maxIndex = 0;
for (int i = 1; i < results.length; i++) {
if (results[maxIndex].getConfidence() < results[i].getConfidence())
maxIndex = i;
}
if (results[maxIndex].getConfidence() < 30)
maxIndex = -1; // no match
assertTrue("Index 9 is not the highest confidence level", maxIndex == 9);
}
private FormRecognitionResult[] createResultArray() {
FormRecognitionResult[] results = new FormRecognitionResult[10];
for (int i = 0; i < results.length; i++) {
results[i] = new FormRecognitionResult();
results[i].setConfidence(i * 10 + 10);
}
return results;
}