Skip to content

Data Matrix Code Reader vTool#

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

The Data Matrix Code Reader can detect and decode Data Matrix 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 Data Matrix code was found. The text output is the text string encoded by the Data Matrix code.

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

Data Matrix Code Reader vTool

Data Matrix Code Reader Versions#

Three versions of the Data Matrix 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.

Starter Basic Pro
How many Data Matrix codes can you detect? 3 3 Unlimited
Can you detect GS1 Data Matrix codes? No Yes Yes
Can you specify a timeout for detection? No Yes Yes
Which module sizes are allowed? Side lengths of 3 pixels Side lengths between 6–20 pixels Side lengths between 2–100 pixels
Are gaps between modules allowed? No No Yes
Are modules allowed to be slanted? Yes, but the module size must be complied with Yes, up to 10 ° Yes, up to 30 °
Do the modules have to lie within the matrix grid structure? Yes Yes No
Can you detect light-on-dark Data Matrix codes? No
This requires a preprocessing step.
No
This requires a preprocessing step.
Yes
Can you detect mirrored Data Matrix codes? Yes Yes Yes
Is the Enhanced detection mode available? No No Yes
Valid data types for Roi input pin RectangleF RectangleF, RectangleF Array, Region, Region Array RectangleF, RectangleF Array, Region, Region Array

How It Works#

Info

The Data Matrix Code Reader Starter vTool doesn't support GS1 QR code detection.

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

In the Basic und Pro versions, you can specify a timeout to end detection after a certain amount of time. If you know that your images only contain one Data Matrix code, configuring the Data Matrix Code Reader to only look for one code may save processing time.

Common Use Cases#

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

Data Matrix Code Reader Starter#

You can detect up to three Data Matrix codes in an image. Limiting the number to the expected number of codes in an image may save processing time. Detection of GS1 Data Matrix codes isn't supported. For this, you need the Basic or Pro version of the vTool.

Detection Criteria#

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

  • Code structure: The Data Matrix Code Reader supports the standard Data Matrix code ECC200 structure (matrices with 8 to 144 rows and 10 to 144 columns).
  • Module size: The sides of individual modules in the matrix must not be longer than 3 pixels.
  • Gaps between modules: Gaps between modules are not allowed.
  • Slant: Codes are allowed to be slanted as long as the module size is not exceeded.
  • Grid conformity: All modules must lie within the matrix grid.
  • Polarity: Data Matrix codes must be dark-on-light patterns. For light-on-dark patterns, run a preprocessing step to invert the input image, e.g., by using the Gray Value Transformer vTool.
  • Mirroring: Data Matrix codes mirrored vertically, horizontally, or both can be detected.
  • Legibility: Codes must be free from visual flaws, e.g., no reflections or smudging, and must have sufficient resolution.

Configuring the vTool#

To configure the Data Matrix Code Reader Starter vTool:

Data Matrix Code Reader Starter vTool Settings

  1. In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
    The Data Matrix Code Reader Starter dialog opens.
  2. In the Number of Data Matrix Codes area, select how many Data Matrix codes you want to detect.

You can view the result of the Data Matrix Code Reader Starter in a pin data view. Here, you can select which outputs to display.

Data Matrix Code Reader Basic#

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

Detection Criteria#

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

  • Code structure: The Data Matrix Code Reader supports the standard Data Matrix code ECC200 structure (matrices with 8 to 144 rows and 10 to 144 columns).
  • Module size: The sides of individual modules in the matrix must be between 6 and 20 pixels long.
  • Gaps between modules: Gaps between modules are not allowed.
  • Slant: Codes with a slant up to 10 ° can still be read.
  • Grid conformity: All modules must lie within the matrix grid.
  • Polarity: Data Matrix codes must be dark-on-light patterns. For light-on-dark patterns, run a preprocessing step to invert the input image, e.g., by using the Gray Value Transformer vTool.
  • Mirroring: Data Matrix codes mirrored vertically, horizontally, or both can be detected.
  • Legibility: Codes must be free from visual flaws, e.g., no reflections or smudging, and must have sufficient resolution.

Data Code Types#

The Data Code Type drop-down list allows you to select the data code type you want to look for:

  • Data Matrix Codes
  • GS1 Data Matrix Codes

The symbol structure of Data Matrix codes and GS1 Data Matrix codes is identical but their coding schemes are different.

When decoding standard Data Matrix codes, the Data Matrix Code Reader outputs the raw strings. If you select GS1 Data Matrix codes, the Data Matrix Code Reader decodes the strings in a format that is compliant with the GS1 standard.

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 Data Matrix 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 Data Matrix Code Reader Basic vTool:

Data Matrix 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 Data Matrix Code Reader Basic dialog opens.
  2. In the Data Code Type drop-down list, select the desired data code type.
  3. In the Number of Data Matrix Codes area, select how many Data Matrix codes 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 Data Matrix Code Reader Basic in a pin data view. Here, you can select which outputs to display.

Data Matrix Code Reader Pro#

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

Detection Criteria#

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

  • Code structure: The Data Matrix Code Reader supports the standard Data Matrix code ECC200 structure (matrices with 8 to 144 rows and 10 to 144 columns).
  • Module size: The sides of individual modules in the matrix must be between 2 and 100 pixels long.
  • Gaps between modules: Small gaps between modules are allowed.
  • Slant: Codes with a slant up to 30 ° can still be read.
  • Grid conformity: Modules that are partially outside the matrix grid can still be read.
  • Polarity: Data Matrix codes can be dark-on-light or light-on-dark patterns or a mixture of both.
  • Mirroring: Data Matrix codes mirrored vertically, horizontally, or both can be detected.
  • Legibility: Codes with visual flaws, e.g., reflections or smudging, and with low resolution can be detected.

Data Code Types#

The Data Code Type drop-down list allows you to select the data code type you want to look for:

  • Data Matrix Codes
  • GS1 Data Matrix Codes

The symbol structure of Data Matrix codes and GS1 Data Matrix codes is identical but their coding schemes are different.

When decoding standard Data Matrix codes, the Data Matrix Code Reader outputs the raw strings. If you select GS1 Data Matrix codes, the Data Matrix Code Reader decodes the strings in a format that is compliant with the GS1 standard.

Detection Mode#

In Enhanced detection mode, the Data Matrix Code Reader is more tolerant regarding the quality of the Data Matrix 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 Data Matrix 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 Data Matrix Code Reader Pro vTool:

Data Matrix 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 Data Matrix Code Reader Pro dialog opens.
  2. In the Data Code Type drop-down list, select the desired data code type.
  3. In the Number of Data Matrix Codes area, select how many Data Matrix codes you want to detect. Select Unlimited if the maximum number of codes to be detected is not known.
  4. Select the Use enhanced detection check box if desired.
  5. 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.
  6. 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 Data Matrix 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 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 Data Matrix code.

  • Data type: String Array

Regions#

Returns the region of every Data Matrix 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#