GdPicture.NET.14
GdPicture14 Namespace / GdPictureOCR Class / GetAverageWordConfidence Method
The unique result identifier of the executed OCR process obtained by the RunOCR method.
Example





In This Topic
GetAverageWordConfidence Method (GdPictureOCR)
In This Topic
Returns the average word confidence of a specified OCR result.
Syntax
'Declaration
 
Public Function GetAverageWordConfidence( _
   ByVal OCRResultID As String _
) As Integer
public int GetAverageWordConfidence( 
   string OCRResultID
)
public function GetAverageWordConfidence( 
    OCRResultID: String
): Integer; 
public function GetAverageWordConfidence( 
   OCRResultID : String
) : int;
public: int GetAverageWordConfidence( 
   string* OCRResultID
) 
public:
int GetAverageWordConfidence( 
   String^ OCRResultID
) 

Parameters

OCRResultID
The unique result identifier of the executed OCR process obtained by the RunOCR method.

Return Value

The value of the average word confidence in the range 0 (worst accuracy) to 100 (best accuracy).

Please always use the GetStat method to determine if this method has been successful.

Remarks
It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.
Example
How to find out the average word confidence of the processed OCR.
Dim caption As String = "Example: GetAverageWordConfidence"
Using gdpictureOCR As GdPictureOCR = New GdPictureOCR()
    'Set up your prefered parameters for OCR.
 
    'Set up the image you want to process. This step is mandatory.
 
    'Run the OCR process.
    Dim resID As String = gdpictureOCR.RunOCR()
    If gdpictureOCR.GetStat() = GdPictureStatus.OK Then
        Dim wordConf As Integer = gdpictureOCR.GetAverageWordConfidence(resID)
        If gdpictureOCR.GetStat() = GdPictureStatus.OK Then
            MessageBox.Show("The average word confidence of this OCR result is: " + wordConf, caption)
        Else
            MessageBox.Show("The GetAverageWordConfidence() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption)
        End If
    Else
        MessageBox.Show("The OCR process has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption)
    End If
 
    'Continue ...
End Using
string caption = "Example: GetAverageWordConfidence";
using (GdPictureOCR gdpictureOCR = new GdPictureOCR())
{
    //Set up your prefered parameters for OCR.
 
    //Set up the image you want to process. This step is mandatory.
 
    //Run the OCR process.
    string resID = gdpictureOCR.RunOCR();
    if (gdpictureOCR.GetStat() == GdPictureStatus.OK)
    {
        int wordConf = gdpictureOCR.GetAverageWordConfidence(resID);
        if (gdpictureOCR.GetStat() == GdPictureStatus.OK)
            MessageBox.Show("The average word confidence of this OCR result is: " + wordConf, caption);
        else
            MessageBox.Show("The GetAverageWordConfidence() method has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption);
    }
    else
    {
        MessageBox.Show("The OCR process has failed with the status: " + gdpictureOCR.GetStat().ToString(), caption);
    }
 
    //Continue ...
}
See Also