<a id="brc2-using"></a>

# Using EasyBarCode

<a id="easybarcode2-symbologies"></a>

## Symbologies

A symbology defines how a bar code is encoded using its bars and spaces.

In **EasyBarCode**, the following symbologies are enabled by default:

| Code 128                            | Ean 8                        | Ean 13               |
|-------------------------------------|------------------------------|----------------------|
| GS1 128                             | Code 39                      | Code 39 Extended     |
| Code 39 Reduced                     | Code 93                      | Code 93 Extended     |
| GS1 DataBar Omnidirectional         | GS1 DataBar Limited          | GS1 DataBar Expanded |
| GS1 DataBar Omnidirectional Stacked | GS1 DataBar Expanded Stacked |                      |

The following symbologies are also supported:

| ITF-14             | Pharmacode (one track)   | PDF417              |
|--------------------|--------------------------|---------------------|
| Codabar            | MSI                      | UPC A               |
| UPC E              | ADS Anker                | BC412               |
| Code 11            | Code 13                  | Code 25 Datalogic   |
| Code 25 Matrix     | Code 25 Iata             | Code 25 Industry    |
| Code 25 Compressed | Code 25 Inverted         | Code 25 Interleaved |
| Code 32            | Code BCD Matrix          | Code CIP            |
| Code STK           | IBM Delta Distance A     | Plessey             |
| Telepen            | Binary Code              | RSS14               |
| RSS14 Limited      | RSS14 Expanded           |                     |

#### SEE ALSO
A description of the properties and look of each symbology can be found [here](../list_of_supported_codes.html.md#list-supported-barcodes)

To setup the symbologies to consider during the reading operation, use the following methods of the [`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) class:

* [`EBarCodeReader::EnableSymbology`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a91f3f92fe7d2fc55aa2ca233b44a80fc) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a70c39b5df9b0f859a27ff00f5c4a5375) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a894c815aa893ef3ea1a8f0deb26d752b)
* [`EBarCodeReader::EnableSymbologies`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a8775608d944aa073f59cd0176351cd05) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aee593b6090bdd74e760ca7c8015f2010) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a49976c43bd9c3bf678672139dab5cf03)
* [`EBarCodeReader::EnableSafeSymbologies`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ae2f33e5efc09f893c9e4a2842b4aa917) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a88ac5e7682630422188171de9cec9d2c) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aa245339fe946936fdffff87ec6f47e33)
* [`EBarCodeReader::EnableDefaultSymbologies`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a7d1ae9d84e6c6035eeefbfc0aa9b44c2) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aba26f3e1067a9dbab90dce17588b0b19) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a3b97d5e0d4ab97dd566105ce101c4b63)
* [`EBarCodeReader::DisableAllSymbologies`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ab48b0f2609bf1a2c9f06465c604be65d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a5d02945805a9f47cad24d8a443d98017) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aa530f568859607ad7fca565a484e0585)
* Use [`EBarCodeReader::GetEnabledSymbologies`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ab63073ea300e1327bce7c5124592f0f4) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a96f49f885473c8c824f553ee13fb9edb) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#af61d8fcd78bea033aef48214434458ee) to check the enabled symbologies.

  #### NOTE
  [`EBarCodeReader::EnableSafeSymbologies`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ae2f33e5efc09f893c9e4a2842b4aa917) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a88ac5e7682630422188171de9cec9d2c) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aa245339fe946936fdffff87ec6f47e33) does not enable the [`EBarCodeSymbologies_PDF417`](../../../doxygen_cpp/namespaceeVision_1_1EasyBarCode2.html#a06fdc65fcbb45f88b8d85afed229845ca9db388b3eec10fe5562e01d402927e53) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision_1_1EasyBarCode2.html#aa03cb1097465e618c6abedfe3e23f06d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeSymbologies.html#a7684ca4a5a125872b26e5aea9eb341cd), the [`EBarCodeSymbologies_CodeStk`](../../../doxygen_cpp/namespaceeVision_1_1EasyBarCode2.html#a06fdc65fcbb45f88b8d85afed229845ca302774e56aafddbfe4b6d87e076e1eaf) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision_1_1EasyBarCode2.html#aa03cb1097465e618c6abedfe3e23f06d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeSymbologies.html#a32143498ccf90b9d742c7c545e19d943), the [`EBarCodeSymbologies_BinaryCode`](../../../doxygen_cpp/namespaceeVision_1_1EasyBarCode2.html#a06fdc65fcbb45f88b8d85afed229845ca50edf7e57811f9c27a0f6f13d2ef5cb9) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision_1_1EasyBarCode2.html#aa03cb1097465e618c6abedfe3e23f06d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeSymbologies.html#af14bec8e59c42202b789b36097aae8e0) and the [`EBarCodeSymbologies_PharmacodeOneTrack`](../../../doxygen_cpp/namespaceeVision_1_1EasyBarCode2.html#a06fdc65fcbb45f88b8d85afed229845ca1e06c9e4942a7bd6bcfc7ad515701446) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision_1_1EasyBarCode2.html#aa03cb1097465e618c6abedfe3e23f06d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeSymbologies.html#a7d443b5c9e4fc4ecc8d8db6a20d95ea6) symbologies:
  - Enabling the `PDF417` symbology modifies the detection process, which may be detrimental to detect other symbologies.
  - The three other symbologies are very permissive and can generate a large amount of false positives.

  You must explicitly use [`EBarCodeReader::EnableSymbology`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a91f3f92fe7d2fc55aa2ca233b44a80fc) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a70c39b5df9b0f859a27ff00f5c4a5375) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a894c815aa893ef3ea1a8f0deb26d752b) to enable the `PDF417`, `CodeStk`, `BinaryCode` and `PharmacodeOneTrack` symbologies.
* Because some symbologies are similar, a given bar code can be detected as corresponding to more than one. Use [`EBarCode::GetSymbologies`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a40ced388a0f96f9298165c142a9454c2) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a3d9d66f49269505d766b89b52ddba528) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a03d0a9cf90419a2b29a236d283b45afd) to retrieve all compatible symbologies, in order of decreasing confidence.
* Use [`EBarCode::GetDecodedString`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a6212f783f14dad58a6461286c7009faf) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a670cc15ced8eee65eea93f0016804f2d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#aee7f712cb6932919c95e53ab9b7cefdc) with its optional symbology parameter to retrieve the decoded string as decoded given the symbology passed as parameter. If you omit this parameter, the decoded string will be decoded using the most likely symbology.
* For the `GS1-128` and `GS1 DataBar Omnidirectional`,  `Limited`,  `Expanded`, `Omnidirectional Stacked` and `Expanded Stacked` symbologies:
  * Use [`EBarCode::GetDecodedString`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a6212f783f14dad58a6461286c7009faf) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a670cc15ced8eee65eea93f0016804f2d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#aee7f712cb6932919c95e53ab9b7cefdc) to get the machine-readable code (for example:` ]C11118011215190101`).
  * Use [`EGs1Translator::GetHumanReadableCode`](../../../doxygen_cpp/classeVision_1_1EGs1Translator.html#a7d8dacd41b6196defa88758d5986c6a4) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EGs1Translator.html#a6026434928b11f93ff0c3875d4bab1da) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EGs1Translator.html#a1a39a3262b14b78cb3675ec4fd57630b) to get the human-readable version (for example: `(11)180112(15)190101`).
* Some characters can be encoded using ECI in the [`EBarCodeSymbologies_PDF417`](../../../doxygen_cpp/namespaceeVision_1_1EasyBarCode2.html#a06fdc65fcbb45f88b8d85afed229845c) [<sub>.NET</sub>](../../../doxygen_cs/namespaceeVision_1_1EasyBarCode2.html#aa03cb1097465e618c6abedfe3e23f06d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeSymbologies.html) symbology. In such cases, the returned [`EBarCode`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html) contains the encoded data converted to `utf-8`.

<a id="easybarcode2-checksum"></a>

## Checksum and Validation

The checksum of a bar code enables the reader to validate the bar code contents, most symbologies possess one, see the [list](../list_of_supported_codes.html.md#list-supported-barcodes).

* By default, **EasyBarCode** checks the checksum validity when required by the symbology specifications.
  * The symbologies `Code39` (and variants), `Codabar`, `Code 11` and `Code 25` (and variants) define but do not enforce a checksum. We call their checksum optional. By opposition, the checksums that are always present are called mandatory. When the checksum is optional, there is no way to know if the barcode contains one from the image alone and no checksum validation is performed by default.
  * For the `PharmacodeOneTrack` symbology, by default, no checksum is computed but additional validations are performed on the bar code vertical uniformity to rule out false positives.
* To reject bar codes if they fail mandatory or optional checksum validation or Pharmacode validation, respectively use [`EBarCodeReader::SetValidateMandatoryChecksum`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a6ef85a1e7e7d881495eac94022b5a1ce) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a68c69c897a0edf12f4482f55e73dcfcf) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#acf310779c7139bc3e2816cca31556b62), [`EBarCodeReader::SetValidateOptionalChecksum`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a3cd19a3cc79ac2fd5347f05cf35b4bc0) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aae79d8b3a06fc0df8f5e05cf49d4c845) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a7b32dd11210c8367258b6f0d5ddfe52a) and [`EBarCodeReader::SetValidatePharmacode`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#af52b55d5773efc9500a0e76edaf1832f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ae0be63fab4e5bc74f8c04b77e692b58e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a86064aa8293d89ee977fe74414313185).
  * Set the property to `true`, to not return bar codes failing the corresponding validation.
  * By default, [`EBarCodeReader::GetValidateMandatoryChecksum`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a2a04cc67f456f35b4ee962fb3167d50f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a68c69c897a0edf12f4482f55e73dcfcf) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#acf310779c7139bc3e2816cca31556b62) and [`EBarCodeReader::GetValidatePharmacode`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aed3d46de27596d6fceead548667aae00) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ae0be63fab4e5bc74f8c04b77e692b58e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a86064aa8293d89ee977fe74414313185) are set to `true` and [`EBarCodeReader::GetValidateOptionalChecksum`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a75ca84de1272b439c9fe2db28086e192) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aae79d8b3a06fc0df8f5e05cf49d4c845) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a7b32dd11210c8367258b6f0d5ddfe52a) is set to `false`.
* Call [`EBarCode::GetChecksumOK`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a21df6c72dbe03e5ae9b1fc1d60a8d035) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a3fb6d688fdae22158d2c0b6d0be1e701) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#ac7743fc10346467657d1186c2302073e) to check the checksum status of the returned [`EBarCode`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html) object.
* By default, the checksum characters are included into the string returned by [`EBarCode::GetDecodedString`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a6212f783f14dad58a6461286c7009faf) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a670cc15ced8eee65eea93f0016804f2d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#aee7f712cb6932919c95e53ab9b7cefdc).
  * Set the optional parameter `includeChecksum` to `false` to remove these checksum characters from the returned string,

  #### NOTE
  As mentioned above, some symbologies, such as `Code39` have optional checksum characters. In those cases, determining their presence automatically is usually not possible. Thus, setting `includeChecksum` to `false` might crop parts of the decoded string.

#### SEE ALSO
Refer to the following code snippet as an example: [Reading a Bar Code Following a Given Symbology](../../../resources/code_snippets/text_and_code_reading/easybarcode/easybarcode2/readingabarcodefollowingagivensymbology2.html.md)

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

## Grading Bar Codes

To compute the print quality indicators as defined by the **ISO 15416** standard:

1. Set the [`EBarCodeReader::SetComputeGrading`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a3e0207f0bc6f2da73ced8b53f9492ca9) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aa4ba8bcbce2239bbf11163e03c564853) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a18dcaf28de0618dbd701fd437e4800a9) to `true`.
2. The print quality of the bar codes is computed during the [`EBarCodeReader::Read`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a82a90c2861ab8b77859b3d3ac0ea154f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#adf5742837f2fe289a51ef4a56ae5fe80) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a3441ffc9eb4eb2f9ca77ae7396d7c2f3) operation.
3. Retrieve the grades with the accessor [`EBarCode::GetGradingParameters`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a7a986712fc22f7ecb807d19a3ec52c69) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a38e2f1774f142c75dbd30c8462f693ef) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a18b8f64eba5b0010249fa8d3e6b79ff6) of the class [`EBarCode`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html).

   This will retrieve an [`EBarCodeGradingParameters`](../../../doxygen_cpp/structeVision_1_1EasyBarCode2_1_1EBarCodeGradingParameters.html) [<sub>.NET</sub>](../../../doxygen_cs/structeVision_1_1EasyBarCode2_1_1EBarCodeGradingParameters.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeGradingParameters.html) object.
4. Retrieve the numeric grades (0 to 40) directly from the object.
5. Use the method [`EBarCodeGradingParameters::ConvertToAlphabeticGrade`](../../../doxygen_cpp/structeVision_1_1EasyBarCode2_1_1EBarCodeGradingParameters.html#aa7b7e645a2f57436612e05a1f2296fe2) [<sub>.NET</sub>](../../../doxygen_cs/structeVision_1_1EasyBarCode2_1_1EBarCodeGradingParameters.html#add5ce389d4e4091aa06be107050db735) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeGradingParameters.html#ae5ca9f22234bf74c72dc9fc265660b74) to convert the numeric grades to alphabetic grades (F to A).

#### NOTE
At the moment, grading is only supported for the `Ean 13`, `Code 128` and `GS1 128` symbologies. Don’t hesitate to contact the support if you need grading of other symbologies.

#### SEE ALSO
* Refer to the following code snippet as an example: [Grading a Bar Code](../../../resources/code_snippets/text_and_code_reading/easybarcode/easybarcode2/gradingabarcode.html.md).
* For more information on code grading, see [Code Grading](../code_grading/index.html.md).

<a id="easybarcode2-advanced"></a>

## Advanced Features

<a id="easybarcode2-ebarcode-contents"></a>

### Contents of the `EBarCode` Object

When a bar code is read from an image, the [`EBarCode`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html) object contains the following information:

* The [`decoded string`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a6212f783f14dad58a6461286c7009faf) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a670cc15ced8eee65eea93f0016804f2d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#aee7f712cb6932919c95e53ab9b7cefdc) of the bar code.
* The [`position`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a4ca192de4f94a32aa93e7cbc14c9a6e1) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a3fc7615cf40697679ff298b46ff68d75) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a3f7ce20b54b02c4b949b927941043bd9) of the bar code.
* One or several [`symbologies`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a40ced388a0f96f9298165c142a9454c2) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a3d9d66f49269505d766b89b52ddba528) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a03d0a9cf90419a2b29a236d283b45afd) compatible with the bar code.
* [`Whether the checksum of the barcode is ok`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a21df6c72dbe03e5ae9b1fc1d60a8d035) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a3fb6d688fdae22158d2c0b6d0be1e701) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#ac7743fc10346467657d1186c2302073e).
* Whether the [`pattern`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a7383bc53ffb50fa902f70ee69ea05f41) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#af008b4912dd16f3d56aa96e1958dbca3) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a213d2ee28724b311f6cb13caebc215c2), [`advanced decoding`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#ac755de26b4fb5d9eaa241028a2e48eae) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#aa819162e3e5a1dff74ed3424f8137b14) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a373bbf8fa7f07e5828d35bfb3ef2c0d2) or [`printing error`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a0cb1f5bdf59cc906b08c48a4f02da25d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#ac887f0a5d1ae1ea236f89c6d1eca0858) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a563550d327ce065738b6de8f89af1aed) error correction was used.
* The [`grading parameters`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a7a986712fc22f7ecb807d19a3ec52c69) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a38e2f1774f142c75dbd30c8462f693ef) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a18b8f64eba5b0010249fa8d3e6b79ff6) of the bar code.
* Draw methods for the [`decoded string`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#ad382cf26032f61c6657d42b9fffbdd8f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a34f5ce8ce016c308778143c355cbd99a) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#ae55c76c7ea3cf01f6b75726e49ab58fe) and [`position`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#ad719aaafa19e8dcaa5a8ce20baf41ae3) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a79bd3c2ae630355b80a0455bc0388057) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a4a88e1ca5dd000507bfa4edddf2c9d7e) of the bar code.

<a id="easybarcode2-region"></a>

### Reading using an ERegion

* Use [`EBarCodeReader::Read`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a82a90c2861ab8b77859b3d3ac0ea154f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#adf5742837f2fe289a51ef4a56ae5fe80) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a3441ffc9eb4eb2f9ca77ae7396d7c2f3), using an overload taking an [`ERegion`](../../../doxygen_cpp/classeVision_1_1ERegion.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ERegion.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ERegion.html) to restrict the domain on which the [`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) detects and reads the bar codes .

![image](assets/images/easybarcode2/reading_5.webp)

<a id="easybarcode2-grid"></a>

### Reading using a Grid

If the codes in the images are arranged in a regular grid-like fashion:

* Use the dedicated [`EBarCodeReader::Read`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a82a90c2861ab8b77859b3d3ac0ea154f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#adf5742837f2fe289a51ef4a56ae5fe80) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a3441ffc9eb4eb2f9ca77ae7396d7c2f3) overloads that take an [`EGrid`](../../../doxygen_cpp/classeVision_1_1EGrid.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EGrid.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EGrid.html) object to improve the reliability and the speed of the reading.
* Use the methods [`EGrid::SetEnableCell`](../../../doxygen_cpp/classeVision_1_1EGrid.html#aba771f188948f660da2c0194a9b58a3f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EGrid.html#a1fd0da028d375583b1e88dcce0773be4) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EGrid.html#a8b512a41cd91f259e36ecbb171d78865), [`EGrid::SetEnableRow`](../../../doxygen_cpp/classeVision_1_1EGrid.html#a3844f5b8b179aeaf4a2126498caf2f76) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EGrid.html#a773b4e6991849b0ecc1ba54fd3cbcacc) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EGrid.html#a39048b6eb0c0ffd668612f477c310d76), [`EGrid::SetEnableColumn`](../../../doxygen_cpp/classeVision_1_1EGrid.html#a38b2cd477e372de59eb97368b9e99bb8) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EGrid.html#a58a6e9901b3fda53ee457f02a590f049) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EGrid.html#a7f3a7e831554b929a05d5aeb4a78f1ee) or [`EGrid::SetEnableAll`](../../../doxygen_cpp/classeVision_1_1EGrid.html#a94d5c95f83523c96f7f3ce4183117803) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EGrid.html#af176f6ab91c3a5b439526df7442d0ed6) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EGrid.html#a6ab6b2c8a001ead2c95b6c6662ac61dc) to disable the processing of cells that you know do not contain any code.
* Use the method [`EBarCodeGrid::GetResults`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeGrid.html#a92b8e9d833779be50663ec6e5b704760) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeGrid.html#ab34499504d297ee37b9f8695c80cf690) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeGrid.html#a1f496633ad242d7a0c1e3abab4f1ff2f) of the returned [`EGrid`](../../../doxygen_cpp/classeVision_1_1EGrid.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EGrid.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EGrid.html) object to retrieve the codes read in each cell of the defined grid.

#### SEE ALSO
For an example, see [Reading a Grid of Bar Codes](../../../resources/code_snippets/text_and_code_reading/easybarcode/easybarcode2/readingagridofbarcodes.html.md)

![](assets/images/easybarcode2/reading_6.webp)

<a id="easybarcode2-timeout"></a>

### Using a Timeout

If you have a defined time constraint:

* Use [`EBarCodeReader::SetTimeOut`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ad7b46925865e79cde6f0d90d3efedd4b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a59711c0d627249fe7fdada0922e89040) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a18a09756c6445f6e7acd302f13393f9b) to define a timeout for the [`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) object. This timeout limits the amount of time available to the [`EBarCodeReader::Read`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a82a90c2861ab8b77859b3d3ac0ea154f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#adf5742837f2fe289a51ef4a56ae5fe80) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a3441ffc9eb4eb2f9ca77ae7396d7c2f3) method and forces it to return early if needed.

<a id="easybarcode2-orientation"></a>

### Specifying the Orientation of your Codes

For most symbologies, a pattern identifies whether the codes must be read from left to right or right to left.

This is however not the case for the `Code STK`, `Binary Code` and `Pharmacode` symbologies.

For these symbologies, you must know whether to decode the bar code from left to right or from right to left. Use the method [`EBarCodeReader::SetReadingOrientation`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ade229f697c651c02300a4e9888e1bd6c) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a62c1ef52d69ce41babfe024aeb7231f0) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a1637b61468af1ab5fc228146b0506d3d) to specify it.

### Learning from provided Images to Improve the Detection Performances

* The learning automatically tunes the scales at which you try to find a bar code to best fit the set of images you gave it. The `scales` are modified to read the maximum number of codes depending on the parameters of the learn method.
* [`EBarCodeReader::Learn`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ae5be0e049c53529b5f14414cd7f0f002) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a61806a03b881d36e7ffa3840dbc9280b) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a30675202fad315da8a45229de169f762) has two Boolean parameters:
  * `keepDefaultScales` indicates that the `scales` used by default should not be disabled by the learning (`true` by default).
  * `addAllScales` indicates that all the `scales` that allow to detect one code should be enabled (`true` by default).
* Tips:
  * If you perform a learning on a few problematic images, set both parameters to `true`.
  * If you perform a learning on a representative set of problematic images, set `keepDefaultScales` to `true` and `addAllScales` to `false`.
  * If you perform a learning on a representative set of all the images you want to read, set both parameters to `false`.
  * The only benefit to set either of these parameters to `false` is the reading speed. In most cases, the impact should not be important, so you can leave them to `true`. When less than `maxNumCodes` are read in an image, the reader tries to find a code in all the `scales` enabled, which takes time. In that case, setting these parameters to `false` may have an important impact on the speed.

#### SEE ALSO
For an example, see [Learning a Bar Code](../../../resources/code_snippets/text_and_code_reading/easybarcode/easybarcode2/learningabarcode.html.md)

<a id="easybarcode2-errors"></a>

### Correcting Errors

* **EasyBarCode** implements three methods to read more difficult codes. In rare cases, these can cause false positives and so you can disable them.
  * [`EBarCodeReader::SetEnablePatternCorrection`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ac3f06072aaeb3379b285f69009c1715d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a9908354f860f2341412e449c7eb4b1f0) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ac053a82a2eeb204a3bb0eec1fc9ce080): Most bar codes symbologies (`Code128`, `Ean13`,…) group consecutive strips into patterns. The algorithm then decodes the bar code one pattern at a time, and, when the current pattern does not match one of the patterns of the symbology, it tries to match the closest pattern (under some constraints).
  * [`EBarCodeReader::SetEnableAdvancedDecoding`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a1a7f75c372d83702280da3c92f26e067) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a48ce133a9ea26a8e3151dcbc6ebd59bc) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#aa3c79ed1d4497c2f8b73b0f9fed99c4a): Specifically for `Ean13`, `Code128` and `GS1-128`, an advanced algorithm determines the most likely pattern sequence that enforces the checksum.
  * [`EBarCodeReader::SetEnablePrintingErrorCorrection`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a43955ed09b67b1e79ddf77462ec4977e) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#ad256a0735e61b7414e374ca2e3cae2a2) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCodeReader.html#a7937bfe435c093506935395673f8e538): Some printing defects can occur in bar codes (like a bar being one module wide instead of two). Some error correction is enabled for these cases specifically and, as this method is more likely to generate false positives than the other ones, it is disabled by default.
* Once a bar code is returned, use the methods [`EBarCode::GetPatternCorrectionUsed`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a7383bc53ffb50fa902f70ee69ea05f41) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#af008b4912dd16f3d56aa96e1958dbca3) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a213d2ee28724b311f6cb13caebc215c2), [`EBarCode::GetAdvancedDecodingUsed`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#ac755de26b4fb5d9eaa241028a2e48eae) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#aa819162e3e5a1dff74ed3424f8137b14) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a373bbf8fa7f07e5828d35bfb3ef2c0d2) and [`EBarCode::GetPrintingErrorCorrectionUsed`](../../../doxygen_cpp/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a0cb1f5bdf59cc906b08c48a4f02da25d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyBarCode2_1_1EBarCode.html#ac887f0a5d1ae1ea236f89c6d1eca0858) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyBarCode2_1_1EBarCode.html#a563550d327ce065738b6de8f89af1aed) to check if each of these algorithms was used to detect the bar code.
