Accuracy & Performance Considerations

Type of Barcode

Don’t make the toolkit work harder than it has to. Turn off any barcode types you don’t want to read. For example, if you only want to scan for Code 39 and Code 25 barcodes you should do the following:

 

Direction of Barcode

By default the toolkit will scan for barcodes in all 4 directions. It’s worth setting the ScanDirection mask to the value that matches the type of document you are reading.

Thoroughness of Search

By default the toolkit will check every 9th scan line in an image for a barcode. You can change this value by setting the LineJump property. Poor quality documents such as faxes will often need to be scanned with LineJump = 1. The process takes longer but is more likely to detect a barcode.

Skew Tolerance

Some images are scanned at a skewed angle and some barcode labels are attached to documents at an angle. By default the toolkit will only read a barcode where a horizontal or vertical line can be passed through the entire length. The SkewTolerance property controls the maximum angle of skew that will be checked by the toolkit. The process will take longer when a higher value is used. 

Note that the LineJump and SkewTolerance properties have a multiplier effect on the speed of the toolkit.

Noise Reduction

Noise Reduction can be applied to images that contain a lot of random black dots. These dots interfere with the normal process of detecting a barcode and so may need to be removed by setting the NoiseReduction property. Note that NoiseReduction is only applied when the ScanDirection mask indicates either portrait or landscape only reading.

Another filter that is available is called OverSampling. This is useful if you need to remove white speckles from a barcode image.

Length of Barcode String

Cut down of the possibility of “false positive” results by specifying the length of the barcode string with the MinLength and MaxLength properties. Setting a MinLength of less that 4 can result in false positive results for certain barcode types such as Code 25.

Confidence Levels

When the toolkit scans an image for barcodes it records the number of “hits” made for each barcode that may be in the image. At the end of the scan it looks at this list of hits and decides which barcodes to report back. The MinOccurrence and PrefOccurrence properties are used in this process. The toolkit will always report back a barcode where the hits are equal or greater than PrefOccurrence. If no barcode found in the image then the barcode with the most hits, greater than or equal to MinOccurrence will be reported. On a very poor image it may be necessary to set MinOccurrence = 1.

Multiple Barcodes in an Image

By default the toolkit will stop when it finds the first barcode on an image (where the hits are equal to or greater than PrefOccurrence). Set the MultipleRead property to True if you need to read more than one barcode in an image. Setting this property to True will obviously slow down the process.

Controlling the Image Area Checked for Barcodes

If you know where the barcode should be in an image then you can cut down on process time further by using the SetScanRect method to define the search area within the image.

Reading Barcodes from Color Images

It is possible to read barcodes from color images but you may need to adjust the ColorThreshold property to do so. Before the toolkit scans the image for a barcode it reduces it to a 2 color (black and white) image. During this process it use the ColorThreshold property to decide whether each pixel is black or white. A high value for this property means that more of an image will be converted as black and a low value means that more of the image will be converted as white. When reading barcodes from camera images it may be necessary to try a range of values for ColorThreshold until the barcode is found.

Barcode Recognition Software