<a id="code-grading"></a>

# Code Grading

<a id="code-grading-what"></a>

## What Is Grading?

The “code grading”, or “code quality verification”, is a process that assesses the quality of a printed or engraved code.

* Different grading standards exist, each pertaining to one or more code types, that specify several grading parameters and how to compute them. In addition to these parameters, a global grade is often computed to summarize the overall quality of the code.
* When a code receives a failing grade, identifying which grade(s) caused the failure can help to locate the physical problem.
* The grades are generally returned:
  * As letters, from A (best) to F (worst).
  * As numbers: from 4.0 (best) to 0.0 (worst).
* While grading is meant to assess the print quality of a code, it also requires specific capture conditions to give accurate results. However, if these conditions are not met, the grading results might give insight on how you can improve your acquisition setup for better results.
* The grading standards currently implemented within **eVision** are:
  * [ISO/IEC 15416 for 1D bar codes](iso-iec_15416_for_1d_bar_codes.html.md)
  * [ISO/IEC 15415 for data matrix codes and QR codes](iso-iec_15415_for_data_matrix_and_qr_codes.html.md)
  * [ISO/IEC 29158 for Data Matrix Codes and QR Codes](iso-iec_29158_for_data_matrix_and_qr_codes.html.md)
  * [SEMI T10-0701 for data matrix codes](semi_t10-0701_for_data_matrix_codes.html.md)

<a id="code-grading-how"></a>

## How to Compute Grading with eVision

In **eVision**, each type of code is handled by a specific reader class:

* 1D Barcode: [`EBarCodeReader`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html)
* QR Codes: [`EQRCodeReader`](../../../doxygen_cpp/classeVision_1_1EQRCodeReader.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EQRCodeReader.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EQRCodeReader.html)
* Data Matrix Codes: [`EMatrixCodeReader`](../../../doxygen_cpp/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyMatrixCode2_1_1EMatrixCodeReader.html)

While the reader classes are different, the way to compute and retrieve the grading results is the same:

1. Instantiate the relevant reader class.
2. Use `SetComputeGrading(true)` to enable the grading computation.
3. For **ISO 29158** only, use `SetIso29158CalibrationParameters` to set up the calibration parameters (see [ISO/IEC 29158 for Data Matrix Codes and QR Codes](iso-iec_29158_for_data_matrix_and_qr_codes.html.md)).
4. Use `Read` on an image containing a code to read and grade the code.
5. Use the corresponding accessor(s) to retrieve the calibration results for the relevant grade(s):
   * For **ISO 15415**: `GetIso15415GradingParameters`
   * For **ISO 15416**: `GetIso15415GradingParameters`
   * For **ISO 29158**: `GetIso29158GradingParameters`
   * For **SEMI T10-0701**: `GetSemiT10GradingParameters`

<a id="code-grading-implementations-limitations"></a>

## Implementation Specifics and Limitations

<a id="code-grading-implementations"></a>

### General Limitations of the Grading Process

* **eVision** is an image processing software, and, as such, its inputs are arrays of pixels. Most standards discussed in this document provide guidelines based not on pixels, but on continuous surfaces presenting a continuous reflectance.
* Most standards also impose constraints on lighting and camera placement that **eVision** cannot check or enforce.
* All standards also make the hypothesis that the position of the code is perfectly known. That, in practice, is usually not true, especially for 1D bar codes.
  * So, there is no guarantee that **eVision** returns exactly the same grade as other software tools (assuming there is no error in those), as choices made to alleviate or circumvent the previous points can differ.
* If you face important differences in grades for the same image or are unsure why some of your images are graded the way they are, feel free to contact the technical support.

<a id="code-grading-limitations"></a>

### Implementation Specifics

* Given the pretty strict scope and requirements of the grading standards, it can be difficult, if not impossible, to grade some codes when the acquisition conditions are not perfect.
  * Because of this, **eVision** sometimes implements some of the grading processes in a manner slightly different than the canonical one to allow a little more leeway in these conditions.
* These adaptations, however, are made in such a way that if the grading process is made within the requirements of the standard, it yields the required grades as values, as verified by the usage of tools such as conformance calibration test cards.

<a id="code-grading-references"></a>

## References

* **ISO/IEC 15415** - Bar code symbol print quality test specification – Two dimensional symbols: [https://www.iso.org/standard/54716.html](https://www.iso.org/standard/54716.html)
* **ISO/IEC 15416** - Bar code symbol print quality test specification – Linear symbols: [https://www.iso.org/standard/65577.html](https://www.iso.org/standard/65577.html)
* **ISO/IEC 15417** - Code 128 bar code symbology specification: [https://www.iso.org/standard/43896.html](https://www.iso.org/standard/43896.html)
* **ISO/IEC 16022** - Data Matrix bar code symbology specification: [https://www.iso.org/standard/44230.html](https://www.iso.org/standard/44230.html)
* **ISO/IEC 18004** - QR Code bar code symbology specification: [https://www.iso.org/standard/62021.html](https://www.iso.org/standard/62021.html)
* **ISO/IEC 29158** - Direct Part Mark (DPM) Quality Guideline: [https://www.iso.org/standard/69411.html](https://www.iso.org/standard/69411.html)
* **SEMI T10-0701** - Test Method for the Assessment of 2D Data Matrix Direct Mark Quality: [https://store-us.semi.org/products/t01000-semi-t10-test-method-for-the-assessment-of-2d-data-matrix-direct-mark-quality](https://store-us.semi.org/products/t01000-semi-t10-test-method-for-the-assessment-of-2d-data-matrix-direct-mark-quality)
* **GS1** General Specifications: [https://www.gs1.org/standards/barcodes-epcrfid-id-keys/gs1-general-specifications](https://www.gs1.org/standards/barcodes-epcrfid-id-keys/gs1-general-specifications)

<a id="code-grading-contents"></a>

## Contents

ISO/IEC 15416 specification for 1D bar codes

ISO/IEC 15415 specification for data matrix codes and QR codes

ISO/IEC 29158 specification for Data Matrix Codes and QR Codes

SEMI T10-0701 specification for data matrix codes

#### SEE ALSO
In **eVision Studio**, all code readers tools display the corresponding grades in the results tab when `Compute grading` is checked.
