# Grading a Data Matrix Code

This code snippet shows how to read a data matrix code and retrieve its print quality grades.

## C++

```cpp
#include <eVision/EasyMatrixCode/EasyMatrixCode2/EMatrixCodeReader.h>
```

```cpp
using namespace eVision;
namespace EMC2 = eVision::EasyMatrixCode2;
// Load an image
EImageBW8 image;
image.Load("image.bmp");
// Prepare a matrix code reader
EMC2::EMatrixCodeReader reader;
// Tell the reader to compute grades for the read codes
reader.SetComputeGrading(true);
// Read the codes in this image
reader.Read(image);
// Retrieve the detected codes
std::vector<EMC2::EMatrixCode> codes = reader.GetReadResults();
// Retrieve the SemiT10 grades of the first code
EMatrixCodeSemiT10GradingParameters semiT10Grades = codes[0].GetSemiT10GradingParameters();
// Retrieve specific grade values
float cellDefects = semiT10Grades.CellDefects;
float symbolContrast = semiT10Grades.SymbolContrast;
float unusedErrorCorrection = semiT10Grades.UnusedErrorCorrection;
```

#### SEE ALSO
[`EMatrixCodeReader::Read`](../../../../../doxygen_cpp/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a890b23ec2a4a8396cb9c70eac513fc02) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#ad08f5fd519e6a442d9432e056833d764) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#abb1ad9145229c3dd52fe1b576099f6c6), [`EMatrixCodeReader::SetComputeGrading`](../../../../../doxygen_cpp/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a8ac394465c23f8753645bd424249e99e) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a76af19d73e9661ecf7baf3a647634679) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a1ae81dddeb231d8c614528ee661e4284)

## C#

```cs
using eVision;
using EMC2 = eVision.EasyMatrixCode2;
```

```cs
// Load an image
EImageBW8 image = new EImageBW8();
image.Load("image.bmp");
// Prepare a matrix code reader
EMC2.EMatrixCodeReader reader = new EMC2.EMatrixCodeReader();
// Tell the reader to compute grades for the read codes
reader.ComputeGrading = true;
// Read the codes in this image
reader.Read(image);
// Retrieve the detected codes
EMC2.EMatrixCode[] codes = reader.ReadResults;
// Retrieve the SemiT10 grades of the first code
EMatrixCodeSemiT10GradingParameters semiT10Grades = codes[0].SemiT10GradingParameters;
// Retrieve specific grade values
float cellDefects = semiT10Grades.CellDefects;
float symbolContrast = semiT10Grades.SymbolContrast;
float unusedErrorCorrection = semiT10Grades.UnusedErrorCorrection;
```

#### SEE ALSO
[`EMatrixCodeReader.Read`](../../../../../doxygen_cs/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#ad08f5fd519e6a442d9432e056833d764) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a890b23ec2a4a8396cb9c70eac513fc02) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#abb1ad9145229c3dd52fe1b576099f6c6), [`EMatrixCodeReader.ComputeGrading`](../../../../../doxygen_cs/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a76af19d73e9661ecf7baf3a647634679) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a2ee06cfca4b657057a8a1c67a627e49a) [<sub>Python</sub>](../../../../../doxygen_python/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a1ae81dddeb231d8c614528ee661e4284)

## Python

```py
import eVision
from eVision import EasyMatrixCode2 as EMC2
# Load an image
image = eVision.EImageBW8()
image.Load("image.bmp")
# Prepare a matrix code reader
reader = EMC2.EMatrixCodeReader()
# Tell the reader to compute grades for the read codes
reader.ComputeGrading = True
# Read the codes in this image
codes = reader.Read(image)
# Retrieve the SemiT10 grades of the first code
semiT10Grades = codes[0].SemiT10GradingParameters
# Retrieve specific grade values
cellDefects = semiT10Grades.CellDefects
symbolContrast = semiT10Grades.SymbolContrast
unusedErrorCorrection = semiT10Grades.UnusedErrorCorrection
```

#### SEE ALSO
[`EMatrixCodeReader.Read`](../../../../../doxygen_python/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#abb1ad9145229c3dd52fe1b576099f6c6) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a890b23ec2a4a8396cb9c70eac513fc02) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#ad08f5fd519e6a442d9432e056833d764), [`EMatrixCodeReader.ComputeGrading`](../../../../../doxygen_python/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a1ae81dddeb231d8c614528ee661e4284) [<sub>C++</sub>](../../../../../doxygen_cpp/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a2ee06cfca4b657057a8a1c67a627e49a) [<sub>.NET</sub>](../../../../../doxygen_cs/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html#a76af19d73e9661ecf7baf3a647634679)
