Read 1D Barcode Concepts

NI Vision Builder

Identify Parts Tab

Read 1D Barcode Concepts

The Read 1D Barcode step consists of two phases:

  1. Phase during which you specify an region of interest in the image, which helps to locate the region occupied by the barcode.
  2. Phase during which the region you specify is analyzed to decode the barcode.

The following table lists the types of barcodes and their characteristics:

Barcode TypeSupported CharactersLengthDifferent Bar WidthsChecksum
Codabar0-9, - (dash), : (colon), . (period), $ (dollar), / (slash), + (plus)variable2optional
Code 39Uppercase letters A-Z, 0-9, space, - (dash), . (period), $ (dollar), + (plus), % (percent)variable2optional
Code 93Uppercase letters A-Z, 0-9, space, - (dash), . (period), $ (dollar), + (plus), % (percent), * (asterisk)variable4required
Code 128All ASCII characters and control codesvariable4required
EAN 8Numbers only7 data and 1 checksum4required
EAN 13Numbers only12 data and 1 checksum4required
Interleaved 2 of 5Numbers onlyvariable2optional
MSINumbers onlyvariable2required
UPC ANumbers only11 data and 1 checksum4required
PharmacodeNumbers onlyvariable2none
RSS LimitedNumbers only2 data and 1 checksum, 46 elements8required

The limit conditions are different for barcodes that have two different widths of bars and spaces and for barcodes that have four different widths of bars and spaces.

The following factors can cause errors in the decoding phase:

Low Image Resolution

The resolution of an image is determined by the width of the smallest bar and space. These widths must be at least 3 pixels for all barcodes.

High Horizontal or Vertical Light Drift

Light drift is quantified by the difference between the average of the gray level of the left (upper) line and the right (bottom) line of the background of the barcode. Decoding inaccuracies can occur if the light drift is greater than 120 gray levels for barcodes with two different widths of bars and spaces, and it can occur if the light drift is greater than 100 gray levels for barcodes with four different widths of bars and spaces.

Poor Resolution

In overexposed images, the gray levels of the wide and narrow bars in the barcode tend to differ. Decoding results may not be accurate when the difference in gray levels is less than 80 for barcodes with two different widths of bars and spaces, and less than 100 for barcodes with four different widths of bars and spaces.

Consider the difference in gray levels between the narrow bars and the wide bars. The narrow bars are scarcely visible. If this difference of gray level exceeds 115 on 8-bit images (256 gray levels) for barcodes with two different widths of bars and spaces and 100 for barcodes with four different widths of bars and spaces, the results may be inaccurate.

Noise and Reflection

Noise is defined as the standard deviation of a rectangular region of interest drawn in the background. It must be less than 57 for barcodes with two different widths of bars and spaces and less than 27 for barcodes with four different widths of bars and spaces.

Reflections on the barcode can introduce errors in the value read from the barcode. Bars and spaces that are masked by the reflection produce errors.