Bar code voting

Bar code voting is required if the following criteria are met.

  1. You are using both the FineReader and Enhanced Bar Code recognition engines to extract bar codes.

  2. Both engines find a bar code at the exact same location.

When both of these criteria are met, it is necessary to specify how the final result is determined.

For the best results, test the bar code recognition results using each recognition engine. Your test results should help you decide which voting behavior to use.

There are three voting options when bar codes are found at the same location.

Use the FineReader result instead of the Enhanced Bar Code result

In this situation the FineReader result is given a 100% confidence and the Enhanced Bar Code result confidence is lowered to a maximum of 50% if the text of the two bar codes does not match.

If the extracted text of both engines does match, the FineReader result has 100% confidence and is the only result returned.

All results are shown in the Document Viewer during testing and Validation.

Use this method if you find that more bar codes are successfully extracted using the FineReader recognition engine during testing.

Use the Enhanced Bar Code result instead of the FineReader result

In this situation, the Enhanced Bar Code result is given a 100% confidence and the FineReader result confidence is lowered to a maximum of 50% if the text of the two bar codes does not match.

If the extracted text of both engines does match, the Enhanced Bar Code result has 100% confidence and is the only result returned.

All results, including confidences of all bar codes are shown in the Document Viewer during testing and Validation.

Use this method if you find that more bar codes are successfully extracted using the Enhanced Bar Code recognition engine during testing.

Use both results

In this situation, both recognition engine results are extracted, all results are given 50% confidence, and then voting is done via script. Create a script that votes between the two alternatives as required by your project.

The following code sample shows how to choose between the FineReader and Enhanced Bar Code results when they both have the same confidence of 50%. In this case, the user wants to increase the confidence for the Enhanced Bar Code result to 100% for a specific type of documents.

Private Sub Document_AfterLocate(ByVal pXDoc As CASCADELib.CscXDocument, ByVal LocatorName As String)
   If(LocatorName = "BarcodeLocator") Then
      If (pXDoc.Locators.ItemByName(LocatorName).Alternatives.Count > 1) Then
         Dim Index As Integer
         For Index = 0 To pXDoc.Locators.ItemByName(LocatorName).Alternatives.Count
            Dim alternative As CscXDocFieldAlternative
            Set alternative = pXDoc.Locators.ItemByName(LocatorName).Alternatives(Index)
            If UCase(pXDoc.ExtractionClass) = "INVOICES" Then
               If(alternative.BarcodeSource = "EnhancedBarCode") Then
                 alternative.Confidence = 1.0
                  Exit For
               End If
            Else
               If(alternative.BarcodeSource = "FineReader") Then
                  alternative.Confidence = 1.0
                  Exit For
               End If
            End If
         Next
      End If
   End If
End Sub

Here BarcodeSource is a string property exposed on the Alternative object which may have the value of EnhancedBarCode, FineReader, or (empty string).