# EasyMatrixCodeRead

| Support            | ![](assets/images/sample_programs/applies_to/cpp.svg) ![](assets/images/sample_programs/applies_to/cs.svg) ![](assets/images/sample_programs/applies_to/qt.svg) ![](assets/images/sample_programs/applies_to/python.svg)   |
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Required licenses  | **EasyMatrixCode**                                                                                                                                                                                                         |
| Recommended images | Any image from the folder `Sample Images/EasyMatrixCode`                                                                                                                                                                   |
| Location           | `Text and Code Reading/EasyMatrixCodeRead` and `Console samples/Text and Code Reading`                                                                                                                                     |

## Purpose

This sample program demonstrates how to:

- Read a data matrix code in an image.

![](assets/images/sample_programs/text_and_code-easymatrixcoderead.webp)

## Code highlights

1. Locate and read the data matrix codes in the image.
   ```c++
   m_Codes = m_MXC2.Read(m_Src);
   ```
2. Retrieve the text encoded the data matrix code.
   ```c++
   m_DecodedStrings[iCode] = m_Codes[iCode].GetDecodedString();
   ```
3. Draw the grid, the position and the erroneous modules of the data matrix code on the image.
   ```c++
   Codes[iCode].DrawGrid(drawAdapter);
   Codes[iCode].DrawPosition(drawAdapter);
   Codes[iCode].DrawErrors(drawAdapter);
   ```
