You are here: Start » AVL.NET » Function Reference » Computer Vision » Datacodes » AVL.ReadMultipleDataMatrixCodes

AVL.ReadMultipleDataMatrixCodes

Detects and recognizes several Data Matrix codes in one image.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void ReadMultipleDataMatrixCodes
(
	AvlNet.Image inImage,
	AvlNet.Rectangle2D? inRoi,
	AvlNet.CoordinateSystem2D? inRoiAlignment,
	AvlNet.DataMatrixCodeParams inCodeParams,
	AvlNet.DataMatrixDetectionParams inDetectionParams,
	int inMaxCodeCount,
	bool inAllowMultipleScales,
	IList<AvlNet.DataCode> outDataMatrixCodes,
	IList<AvlNet.Path> outCandidates,
	NullableValue<AvlNet.Rectangle2D> outAlignedRoi
)

Parameters

Name Type Range Default Description
inImageAvlNet.ImageInput image.
inRoiAvlNet.Rectangle2D?Region of interest. Default value: atl::NIL.
inRoiAlignmentAvlNet.CoordinateSystem2D?Coordinate system for the region of interest. Default value: atl::NIL.
inCodeParamsAvlNet.DataMatrixCodeParamsSpecification of codes that can be detected.
inDetectionParamsAvlNet.DataMatrixDetectionParamsParameters of the code detection algorithm.
inMaxCodeCountint<0, INF>2Maximum number of codes in one image. Default value: 2.
inAllowMultipleScalesboolFalseSpecifies whether to continue search for codes at a higher resolution even when some codes have already been found at a lower resolution. Default value: False.
outDataMatrixCodesSystem.Collections.Generic.IList<AvlNet.DataCode>List of codes that have been correctly detected and decoded.
outCandidatesSystem.Collections.Generic.IList<AvlNet.Path>Diagnostic information about detection results.
outAlignedRoiAvlNet.NullableValue<AvlNet.Rectangle2D>Input ROI after transformation (in the image coordinates). Can be null to skip this parameter calculation.

Description

This filter detects and recognizes data matrix codes on an image.

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

Groups of parameters

For optimal efficiency the tool may require careful setting of parameters. Most of the parameters are divided into two groups:

  1. inCodeParams – parameters concerning the code; these can be set precisely according to what codes we expect to read
  2. inDetectionParams – parameters concerning the algorithm; these may require some experimentation as different approaches may work best in different scenarios

Detection methods

The most important setting is the selection of the code detection algorithm, inDetectionParams.DetectionMethod. The tool offers three options:

Quiet Zone Finder Pattern Finder Edges
Where it looks?
How it works? Looks for the blank space surrounding the code. In theory it should be empty for a width of at least one module. Looks for the blob of the L-shaped pattern. In theory it should be continuous and not connected with anything outside of the code. Looks for the edges of the L-shaped pattern. It uses a robust Line Segment Detector internally.
When to use it? This method is good even for partially broken Finder Pattern, but it will fail if there is any contamination in the Quiet Zone. This method may deal with some contamination in the Quiet Zone, but it will fail if the Finder Pattern itself is not good. This method works well even if Quiet Zone is contaminated and Finder Pattern is not perfect, but may be confused by additional lines appearing near the code.

Pyramid

The tool tries to detect codes at different scale levels. It investigates images at different resolutions, starting with the lowest resolution. If it finds a sufficient number of codes at one level, it may skip looking further, thus achieving shorter execution time. If there are no codes in the input image, it will always scan all the levels, resulting in the highest execution time.

NOTE: If you experience instable execution times, for example switching between 5 ms and 20 ms, it may mean that for some images the tool finds a code at a higher level, while for some others it has to process a higher resolution too.

Finder Tradeoff ("FinderEdges" only)

When using the "FinderEdges" method, you should be aware that there is a tradeoff between the ability of the tool to detect rugged (uneven, noised or dot printed) edges and the ability to detect low contrast edges (or ones neighboring with a very narrow Quite Zone). The default setting is "Balanced". However, if you expect the edges of your code to be relatively straight and clean, but less strong, you may want to change it to "Sensitive". On the other hand, if the edges of the code are highly jagged or the surrounding is noisy, it may be better to choose "Robust". You may also set it to "Auto" and it will test several possibilities at the cost of much higher execution time.

Use "Sensitive" Use "Balanced" Use "Robust"

Distortions

The tool can deal with various types of code deformations. There are three possible settings, as demonstrated below. Please be aware that when we make the algorithm more robust to distortions, at the same time we make it less robust to broken code patterns. For this reason, we should stay with lower settings whenever possible.

Use "Low" Use "Medium" Use "High"
Each side is represented with a single line segment. Each side is represented with a 3-segment line. Each side is exactly traced with a polyline.

Damaged codes and other difficulties

By using appropriate inCodeParams settings you can also find codes that are partially damaged. See the below table for some of the most common cases.

Use MaxSlant=30 Use AllowPerspective Use AllowBrokenFinder and AllowBrokenTiming Use AllowOversizedModules

Examples

Square

Slanted

Reflection

Overexposure

Remarks

For maximum reliability of reading Data Matrix codes we recommend making sure that the image fulfills the following standard requirements:

  • Module size should be at least 4 pixels, while 5 pixels is recommended for the highest reliability. It may also be possible to read codes with modules of 3 pixels, but this comes with no guarantee.
  • Gaps between dot-printed marks should be not bigger than 50% of the module size, but the less the better.
  • There should be an empty space around the code ("quiet zone"). It should have the width at least equal to the module size. Contamination, additional print or shadows in this area is the most frequent source of reduced reliability.
  • Finder Pattern slant (angular deviation from 90 degrees) should not be greater than 30 degrees.
  • Data Matrix codes are not designed for reading when there is strong perspective projection.

For explanation of the used terminology, please refer to the below picture:

Function Overrides

See also