Bar Code Locator sample to improve recognition
The Bar Code Locator has access to the following two properties and their values when using the OmniPage recognition engine. These can improve recognition speed and accuracy of bar codes:
-
BarTradeOff
-
CscBarcodeLocTradeOffBalanced - balances bar code recognition accuracy with speed.
-
CscBarcodeLocTradeOffMostAccurate - prioritizes bar code recognition accuracy over speed, leading to longer recognition times.
-
CscBarcodeLocTradeOffFastest - prioritizes speed over bar code recognition accuracy, resulting in faster processing but may decrease the overall accuracy.
-
-
BarScanInterval
This parameter indicates how many scan lines are skipped while analyzing a bar code candidate. A scan line is a 1-pixel-height line and bar code candidates are split into scan lines. The default value is 5.
For example, a value of 5 means that every fifth scan line is analyzed. If a value of 1 is set, it means that each scan line is analyzed.
Keep the following in mind when setting the value for this parameter.
-
A lower ScanInterval increases detection time.
-
A higher ScanInterval is recommended when performance is a higher priority or when the quality and size of the input images are good.
Thoroughly test this setting to ensure that small bar codes are detected adequately.
-
The following sample shows the BeforeLocate event configured to use these Bar Code Locator settings. The BarTradeOff property is set to CscBarcodeLocTradeOffFastest and the BarScanInterval is set to 5.
Private Sub Document_BeforeLocate(ByVal pXDoc As CASCADELib.CscXDocument, ByVal LocatorName As String)
If(LocatorName = "<Name of the Bar Code Locator>") Then
Dim Loc As CscBarcodeLocator
Set Loc = Project.ClassByName("<Name of the class>").Locators.ItemByName(LocatorName).LocatorMethod
Loc.BarTradeOff = CscBarcodeLocTradeOffFastest
Loc.BarScanInterval = 5
End If
End Sub