Skip to content

QR Code Reader vTool#

The QR Code Reader vTool allows you to detect QR codes in images and decode them.

The QR Code Reader can detect and decode QR codes in images it receives via the Image input pin. It outputs the results via the Regions and Texts output pins.

The region output contains the region in which a QR code was found. The text output is the text string encoded by the QR code.

QR Code Reader vTool

QR Code Reader Versions#

Two versions of the QR Code 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.

Basic Pro
How many QR codes can you detect? 3 Unlimited
Can you specify a timeout for detection? Yes Yes
Which module sizes are allowed? Side length between 2–100 pixels Side length between 2–100 pixels
Are gaps between modules allowed? Yes, small gaps Yes, large gaps
How many finder patterns must be visible? All three 2
Can you detect light-on-dark QR codes? No
This requires a pre-processing step.
Yes
Can you detect mirrored QR codes? Yes Yes
Are there restrictions regarding the contrast in the images? Sufficient contrast between dark and light image parts is required. The difference between light and dark parts of the image must be at least 10 gray values.
Is the Enhanced detection mode available? No Yes

How It Works#

Info

The QR Code Reader vTool doesn't support Micro QR code detection.

Depending on the version of the QR Code Reader, you can detect up to three or an unlimited number of QR codes in an image.

You can specify a timeout to end detection after a certain amount of time. If you know that your images only contain one QR code, configuring the QR Code Reader to only look for one code may save processing time.

Common Use Cases#

  • Reading QR codes: In this case, you only need to connect the Texts output pin to output the decoded strings.
  • Determining the positions of QR codes: Use the positions and sizes of the QR codes returned by the Regions output pin for subsequent processing.

QR Code Reader Basic#

You can detect up to three QR codes in an image. Limiting the number to the expected number of codes in an image may save processing time.

Detection Criteria#

For QR codes to be detected and decoded, they must meet the following criteria:

  • Code structure: The QR Code Reader Basic supports the standard range of 1 to 40 symbols which corresponds to 21 x 21 up to 177 x 177 modules.
  • Module size: The sides of individual modules in the code must be between 2 and 100 pixels long.
  • Gaps between modules: Small gaps between modules are allowed.
  • Number of finder patterns: The QR code contains 3 finder patterns. All 3 must be visible to read the code.
  • Polarity: QR codes must be dark-on-light patterns.
  • Mirroring: QR codes mirrored vertically, horizontally, or both can be detected.
  • Contrast: Sufficient contrast between dark and light image parts is required.
  • GS1 support: The QR Code Reader supports reading GS1 QR codes.
  • Legibility: Codes must be free from visual flaws, e.g., no reflections or smudging, and must have sufficient resolution and contrast.

Timeout#

For time-critical applications you can specify a timeout. A timeout helps in cases where the processing time varies or can't be foreseen, for example, if the image doesn't contain a QR code. Once the specified timeout is exceeded, the detection process stops and moves on to the next image.

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.

Configuring the vTool#

To configure the QR Code Reader Basic:

QR Code Reader Basic vTool Settings

  1. In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
    The QR Code Reader Basic dialog opens.
  2. In the Number of QR Codes area, select how many QR codes you want to detect.
  3. 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 QR Code Reader Basic in a pin data view. Here, you can select which outputs to display.

QR Code Reader Pro#

You can detect an unlimited number of QR codes in an image. Limiting the number to the expected number of codes in an image may save processing time.

Detection Criteria#

For QR codes to be detected and decoded, they must meet the following criteria:

  • Code structure: The QR Code Reader supports the standard range of 1 to 40 symbols which corresponds to 21 x 21 up to 177 x 177 modules.
  • Module size: The sides of individual modules in the code must be between 2 and 100 pixels long.
  • Gaps between modules: Big gaps between modules are allowed.
  • Number of finder patterns: The QR code contains 3 finder patterns. 2 must be visible to read the code.
  • Polarity: QR codes can be dark-on-light or light-on-dark patterns or a mixture of both.
  • Mirroring: QR codes mirrored vertically, horizontally, or both can be detected.
  • Contrast: The difference between light and dark parts of the image must be at least 10 gray values.
  • GS1 support: The QR Code Reader supports reading GS1 QR codes.
  • Legibility: Codes with visual flaws, e.g., reflections or smudging, and with low resolution or contrast can be detected.

Detection Mode#

In Enhanced detection mode, the QR Code Reader is more tolerant regarding the quality of the QR codes. This means that codes that don't meet all the detection criteria will still be detected. Enabling this option slows down the detection process.

Timeout#

For time-critical applications you can specify a timeout. A timeout helps in cases where the processing time varies or can't be foreseen, for example, if the image doesn't contain a QR code. Once the specified timeout is exceeded, the detection process stops and moves on to the next image.

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.

Configuring the vTool#

To configure the QR Code Reader Pro:

QR Code Reader Pro vTool Settings

  1. In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
    The QR Code Reader Pro dialog opens.
  2. In the Number of QR Codes area, select how many QR codes you want to detect. Select Unlimited if the maximum number of codes to detected is not known.
  3. Select the Use enhanced detection check box if desired.
  4. In the Polarity drop-down list, select the option appropriate for your application.
    If codes in your application have a specific polarity, select the setting accordingly. If the polarity of the codes in the images is not known or multiple codes with different polarities occur, select Any.
  5. 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 QR Code 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.

Outputs#

Texts#

Returns the text string encoded in a QR code.

  • Data type: String Array

Regions#

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

  • Data type: Region Array

Typical Predecessors#

Typical Successors#