Skip to content

Barcode Reader vTool#

The Barcode Reader vTool allows you to detect various types of barcodes in images and decode them.

The Barcode Reader can detect and decode barcodes in images it receives via the Image input pin. It outputs the results via the Regions, the Texts, and Types output pins.

The region output contains the region in which a barcode was found. The text output is the text string encoded by the barcode. The type output indicates the found barcode type.

If you use the ROI Creator vTool to specify a region of interest before detection, the Barcode Reader accepts the ROI data via its Roi input pin. This reduces the area of the image in which the Barcode Reader searches for barcodes which helps to eliminate false candidates. As a side effect, processing will be faster and more robust.

Barcode Reader vTool

Barcode Reader Versions#

Three versions of the Barcode Reader are available. The following table shows the differences between the versions. Click a version in the table heading to jump directly to the relevant section in this topic.

Starter Basic Pro
How many barcodes can you detect? 2 2 Unlimited
Can you specify a timeout for detection? No Yes Yes
Can you search for individual barcode types or barcode groups? Types Groups Groups and types
How many groups of barcodes can you search for simultaneously? None, only individual barcode types 1 Unlimited
Valid data types for Roi input pin RectangleF RectangleF, RectangleF Array, Region, Region Array RectangleF, RectangleF Array, Region, Region Array

How It Works#

Depending on the version of the Barcode Reader, you can select groups of barcodes types or individual barcode types to detect and decode. The number of how many barcodes can be detected in an image also depends on the version.

Detection Criteria#

Barcodes must be dark-on-light patterns.

If your barcodes are printed with inverse polarity, run a preprocessing step to invert the input image, e.g., by using the Gray Value Transformer vTool.

Optimizing Barcode Detection#

Depending on the Barcode Reader version, you have the following options to optimize the detection process:

  • Limiting the number of barcodes to detect: If you know that your images only contain a certain number of barcodes, configuring the Barcode Reader to only look for that number of barcodes may save processing time. Once the specified number of barcodes has been found, the vTool moves on to the next image. If the number of barcodes varies or is unknown, configure the Barcode Reader to look for more codes.
  • Limiting the types of barcodes to detect: Basler recommends selecting only those barcode types that you expect to find in your images. Especially selecting the MSI and PharmaCode barcodes may increase the number of misdetections.
  • Timeout: You can specify a timeout to end detection after a certain amount of time. If the timeout is exceeded, the detection process stops and moves on to the next image, even if the specified number of barcodes hasn't been found yet.
    Basler recommends setting the timeout a bit lower than the desired time limit. This is because the vTool doesn't stop the detection process immediately. Therefore, set the timeout to 70–80 % of the desired time limit.
  • Specifying a ROI: By specifying a region of interest using the ROI Creator vTool, you reduce the area in which the Barcode Reader searches for barcodes which helps to eliminate false candidates. As a side effect, processing will be faster and more robust.

Info

  • If you open the Barcode Reader Basic or the Barcode Reader Starter for the first time, no barcode type is set. You have to select a barcode type first. If no barcode is set, the vTool will report an error for every input image it receives via the Image input pin.
  • If you open the Barcode Reader Pro for the first time, all barcode groups are selected except MSI and PharmaCode.
  • The PharmaCode barcode is a code with a potentially low number of bars. Be aware that in images with a background of line-like patterns, PharmaCodes may be found by mistake.
  • The MSI barcode is a non-self-checking code. Be aware that MSI codes may be found by mistake in some images.

Common Use Cases#

  • Reading barcodes: In this case, you only need to connect the Texts output pin to output the decoded strings. It may be useful to also connect the Types output pin to know which type of barcode was decoded.
  • Determining the positions of barcodes: Use the positions and sizes of the barcodes returned by the Regions output pin for subsequent processing.

Barcode Reader Starter#

The Barcode Reader Starter can detect individual barcode types.

The following barcode types are supported:

  • Codabar
  • Code 128
  • Code 39
  • Code 93
  • DataBar
  • DataBar Expanded
  • EAN-13
  • EAN-8
  • 2/5 Interleaved
  • UPC-A
  • UPC-E

You can detect one or two barcodes in an image. Limiting the number to the expected number of barcodes in an image may save processing time.

Configuring the vTool#

To configure the Barcode Reader Starter vTool:

Barcode Reader Starter vTool Settings

  1. In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
    The Barcode Reader Starter dialog opens.
  2. In the Barcode Types area, select the barcode types you want to look for.
  3. In the Number of Barcodes area, select how many barcodes you want to detect.

You can view the result of the Barcode Reader Basic in a pin data view. Here, you can select which outputs to display.

Barcode Reader Basic#

The Barcode Reader Basic can detect groups of barcode types. Most of these groups include several different barcode types. By selecting a group, all types contained in that group can be detected. For example, by selecting Code 39, the types Code 39 and Code 93 are detected in an image.

The following barcode type groups are supported:

  • EAN: EAN-8, EAN-8 Add-On 2, EAN-8 Add-On 5, EAN-13, EAN-13 Add-On 2, EAN-13 Add-On 5
  • UPC: UPC-A, UPC-A Add-On 2, UPC-A Add-On 5, UPC-E, UPC-E Add-On 2, UPC-E Add-On 5
  • GS1: Code 128, GS1-128, GS1 DataBar Omnidirectional, GS1 DataBar Stacked Omnidirectional, GS1 DataBar Stacked, GS1 DataBar Expanded, GS1 DataBar Expanded Stacked, GS1 DataBar Limited, GS1 DataBar Truncated
  • 2/5: 2/5 Industrial, 2/5 Interleaved
  • Code 39: Code 39, Code 93
  • Codabar: Codabar
  • MSI: MSI
  • PharmaCode: PharmaCode

You can select one barcode type group and detect one or two barcodes in an image. Limiting the number to the expected number of barcodes in an image may save processing time.

Configuring the vTool#

To configure the Barcode Reader Basic vTool:

Barcode Reader Basic vTool Settings

  1. In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
    The Barcode Reader Basic dialog opens.
  2. In the Barcode Type Groups area, select the barcode type groups you want to look for.
  3. In the Number of Barcodes area, select how many barcodes you want to detect.
  4. In the Timeout area, specify whether you want detection to end after a certain amount of time. If you want to specify a timeout, clear the No timeout check box and enter the desired timeout in the input field.

You can view the result of the Barcode Reader Basic in a pin data view. Here, you can select which outputs to display.

Barcode Reader Pro#

The Barcode Reader Pro can detect groups of barcode types or individual barcode types. Most of the barcode type groups include several individual barcode types. By selecting a group, all types contained in that group can be detected. For example, by selecting Code 39, the types Code 39 and Code 93 are detected in an image.

You can select as many barcode type groups or as many individual barcode types as required. There is no limit on how many barcodes can be detected. Limiting the number to the expected number of codes in an image may save processing time.

The following barcode type groups are supported:

  • EAN: EAN-8, EAN-8 Add-On 2, EAN-8 Add-On 5, EAN-13, EAN-13 Add-On 2, EAN-13 Add-On 5
  • UPC: UPC-A, UPC-A Add-On 2, UPC-A Add-On 5, UPC-E, UPC-E Add-On 2, UPC-E Add-On 5
  • GS1: Code 128, GS1-128, GS1 DataBar Omnidirectional, GS1 DataBar Stacked Omnidirectional, GS1 DataBar Stacked, GS1 DataBar Expanded, GS1 DataBar Expanded Stacked, GS1 DataBar Limited, GS1 DataBar Truncated
  • 2/5: 2/5 Industrial, 2/5 Interleaved
  • Code 39: Code 32, Code 39, Code 93
  • Codabar: Codabar
  • MSI: MSI
  • PharmaCode: PharmaCode

Configuring the vTool#

To configure the Barcode Reader Pro vTool:

Barcode Reader Pro vTool Settings

  1. In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
    The Barcode Reader Pro dialog opens.
  2. In the Barcode Types area, select the barcode type groups or barcode types you want to look for.
  3. In the Number of Barcodes area, select how many barcodes you want to detect.
  4. In the Timeout area, specify whether you want detection to end after a certain amount of time. If you want to specify a timeout, clear the No timeout check box and enter the desired timeout in the input field.

You can view the result of the Barcode Reader Pro in a pin data view. Here, you can select which outputs to display.

Inputs#

Image#

Accepts images directly from a Camera vTool or from a vTool that outputs images, e.g., the Image Format Converter vTool.

  • Data type: Image
  • Image format: 8-bit to 16-bit mono or color images. Color images are converted internally to mono images.

Roi#

Accepts a region of interest from the ROI Creator vTool or any other vTool that outputs regions or rectangles. Multiple rectangles or regions are merged internally to form a single region of interest. The Starter version accepts only RectangleF.

  • Data type: RectangleF, RectangleF Array, Region, Region Array

Outputs#

Texts#

Returns the text string encoded in a barcode.

  • Data type: String Array

Regions#

Returns the region of every barcode found. The region is of rectangular shape. It can be used for visualization purposes or for subsequent feature extraction.

  • Data type: Region Array

Types#

Returns the type of every barcode found.

  • Data type: String Array

Typical Predecessors#

Typical Successors#