Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Datacodes » ReadSingleDataMatrixCode_Deprecated


Detects and recognizes one Data Matrix code.

Name Type Range Description
inImage Image Input image
inRoi Rectangle2D* Region of interest
inRoiAlignment CoordinateSystem2D* Coordinate system for the region of interest
inCodeParams DataMatrixCodeParams Specification of codes that can be found
inContrastThreshold Integer 1 - Minimal difference between dark and bright modules
inFlags Integer 0 - Undocumented advanced tweaks for difficult cases
outDataMatrixCode DataCode?
outCandidates PathArray Diagnostic information about detection results
outAlignedRoi Rectangle2D Input ROI after transformation (in the image coordinates)


This filter detects and recognizes one data matrix code on an image.

Supported code types: ECC 200 and ECC 000-140.


  • Connect inImage with the output of your image acquisition filter.
  • Specify the range of possible codes on an image by setting the inCodeParams input. The more narrow is the specification, the faster the filter works.
    • Set inCodeParams.Polarity to specify whether dark-on-bright or bright-on-dark codes are to be read.
    • Specify the range of possible code sizes with inCodeParams.MinRowCount, inCodeParams.MaxRowCount, inCodeParams.MinColumnCount, inCodeParams.MinColumnCount.
    • Specify the range of possible module sizes (in pixels) with inCodeParams.MinModuleSize and inCodeParams.MaxModuleSize.
    • Set inCodeParams.ExpectedGapSize according to the following rules:
      • Zero – no gaps at all (modules are fully filled).
      • Small – gaps up to 25% of the module size.
      • Medium – gaps up to 50% of the module size; it may require a bigger Quiet Zone.
      • Large – gaps up to 75%; comes with no guarantee.
    • Modify inCodeParams.MaxRectangleRatio if you expect to work also with non-square codes. The value specifies maximal ratio between the length of the longer side to the length of the shorter side.
  • Set inContrastThreshold to a value, which is lower than minimal difference of pixel values between a dark and a bright module (contrast), but greater than maximal difference of pixel values within one module (noise level).
  • If you are having problems with reading codes from low quality images, consider adding image morphology or smoothing.


DataMatrix on blurry image.

Low quality DataMatrix code.

DataMatrix on chip.

Rectangular DataMatrix code.


For more information about local coordinate systems please refer to the following article.

Complexity Level

This filter is available on Basic Complexity Level.

See Also