You are here: GdPicture.NET > Documentation > Classes > GdPictureImaging Class > GdPictureImaging Methods > TWAIN Features > TwainBarCodeGetConfidence Method
logo.gif
ContentsIndexHome
PreviousUpNext
GdPictureImaging.TwainBarCodeGetConfidence Method

Returns the degree of certainty of a bar code the engine has in the accuracy of the information obtained on the last acquired image.

C#
public int TwainBarCodeGetConfidence(
    int BarCodeNo
);
Visual Basic
Public Function TwainBarCodeGetConfidence(
    ByVal BarCodeNo As Integer
) As Integer
Parameters
Parameters 
Description 
BarCodeNo 
The barcode number. Must be value between 1 and the number of detected barcodes.  
Returns

The barcode confidence. From 0 (no confidence) to 100 (supreme confidence). Return -1 if current source does not support confidence reporting.

Before using this function make sure that the barcode detection was enabled by the TwainSetBarcodeDetection() function. 

Use the TwainBarCodeGetCount() function to determine how many barcodes have been detected on the last acquired image.

Acquire single image and detect its barcodes

    Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click
        Dim ImageID As Integer
        Dim oGdPictureImaging As New GdPicture.GdPictureImaging
 
        oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a valid demo or commercial license KEY
        If oGdPictureImaging.TwainOpenDefaultSource(Me.Handle) Then
            If oGdPictureImaging.TwainIsBarcodeDetectionAvailable Then
                oGdPictureImaging.TwainSetBarcodeDetection(True)
                ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
                If ImageID <> 0 Then
                    Dim BarCodeCount As Integer = oGdPictureImaging.TwainBarCodeGetCount
 
                    MsgBox(Str(BarCodeCount) + " barcode have been found in the scanned image")
 
                    For i As Integer = 1 To BarCodeCount
                        MsgBox("Type of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetType(i).ToString)
                        MsgBox("Value of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetValue(i))
                    Next
 
                    oGdPictureImaging.ReleaseGdPictureImage(ImageID)
                End If
            Else
                MsgBox("Error: Barcode detection is not available on this scanner")
            End If
 
            oGdPictureImaging.TwainCloseSource()
            MsgBox("Done !")
        Else
            MsgBox("can't open default source, twain state is: " & oGdPictureImaging.TwainGetState.ToString)
        End If
    End Sub
What do you think about this topic? Send feedback!
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.