# Data Matrix Reader2

This function block decodes Data Matrix codes from an image and returns the decoded text values. It is suitable for reading one or multiple Data Matrix symbols present in a frame.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Data Matrix Image` Provide an image (grayscale or color) that contains Data Matrix symbols to be decoded.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Data` This output returns a list of decoded text strings found in the input image.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Timeout` Time limit in milliseconds to wait for decoding. Increasing this gives the block more time to detect faint or difficult symbols.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

When the block is evaluated it examines the provided image for Data Matrix symbols and attempts to decode each one within the configured `Timeout`. If symbols are found, their decoded text values are returned as a list via the `Data` output. If none are found, an empty list is returned.

## 🎯 Features <a href="#features" id="features"></a>

* Detects and decodes multiple Data Matrix symbols from a single image.
* Returns decoded values as plain text strings for easy downstream use.
* Simple timeout control to balance speed and detection robustness.

## 📝 Usage instructions <a href="#usage" id="usage"></a>

1. Provide an image source to `Data Matrix Image` — for example from a camera block or a loaded image.
2. Optionally adjust `Timeout` to allow more time for difficult reads.
3. Use the `Data` output to access decoded values for logging, display, or further processing.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* If the target symbol is in a small area, crop first using `Image ROI Select` so the block only processes the relevant region.
* Improve read reliability by resizing the input with `Image Resize` to increase symbol pixels.
* Clean up noisy images with `Blur`, `Denoising` or `Image Adaptive Threshold` before feeding into this block.
* Use `Show Image` to preview the exact frame being analyzed while you tune preprocessing.
* Save example frames with `Image Logger` or `Image Write` for offline analysis and tuning.
* If you expect other code types (QR, linear barcodes) try `Barcode Reader` as an alternative for those formats.
* If symbols may be rotated, try `Image AutoRotator` or crop different orientations via ROI tools.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No decoded values: check lighting and contrast, crop to the symbol with `Image ROI Select`, increase `Timeout`, or enlarge the image with `Image Resize`.
* Partial or garbled text: ensure the symbol is not blurred — try `Blur` removal or a higher-resolution input.
* False negatives on noisy backgrounds: apply `Image Adaptive Threshold` or other filters to improve foreground/background separation.
* Many symbols but only some decoded: process each ROI separately or increase the `Timeout` and improve image quality for the missing symbols.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/detections-shapes/detectors/data-matrix-reader2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
