<a id="learning-a-matrix-code"></a>

# Learning a Matrix Code

#### WARNING
This library is deprecated, use [**EasyMatrixCode2**](../index.html.md) instead.

To search for specific features and speed up your processing, learn a Matrix code model.

<a id="learning-workflow"></a>

## Workflow

![image](assets/images/easymatrixcode2/emclearningprocessworkflow.webp)
1. Load the image of the matrix code you want to learn.
2. Learn the model:
   * Use the [`EMatrixCodeReader::Learn`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html#ace4f33f1df9e1dae3daddf89131acd85) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html#a06fbd979bdf50870b9fb14d127af1e5b) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html#a2a10a74d2a2dedc0500c2dca525590c4) method with [`EMatrixCode::GetContrast`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#a08786cfe69b384fbb96a78a9ac0991ae) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#a61997bce2799362ffe430fbfce18f905) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#abb20588c8e72325af368c4a7af3991f7), [`EMatrixCode::GetFamily`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#afb61fc87f0e4f938250585ef7e593477) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#a9e0b3b0cd22c71b57f197d56a032e5d9) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#adb31be08ae9c29095097be1ce762bdad), [`EMatrixCode::GetFlipping`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#a867f2b01b6272c6e9d4e701c9a7acf2b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#a0d78ab12a487dac90b4344e70b13f649) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#a8fa931c2b79f6588f6edfb858c3205d6), [`EMatrixCode::GetLogicalSize`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#aef484e264d742635af895e6182326fbb) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#aa88802f3ffa675b9aec6ad7fa31786a1) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#a7bf9494688602285fbb15cd19a3ec1bd) parameters.
   * If you need to learn several matrix codes, use [`EMatrixCodeReader::LearnMore`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html#a95e7aeb16bdd35ee50551d12f908ab7b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html#ae53297e34c5b1f78a85365bd2799f94c) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html#a6404bb0ee6df0477050387c204062bff) and pass additional sample images.
   * Call [`EMatrixCodeReader::Learn`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html#ace4f33f1df9e1dae3daddf89131acd85) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html#a06fbd979bdf50870b9fb14d127af1e5b) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html#a2a10a74d2a2dedc0500c2dca525590c4) to replace [`EMatrixCodeReader`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html) parameters (calling [`EMatrixCodeReader::Learn`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html#ace4f33f1df9e1dae3daddf89131acd85) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html#a06fbd979bdf50870b9fb14d127af1e5b) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html#a2a10a74d2a2dedc0500c2dca525590c4) several times does not accumulate results, while [`EMatrixCodeReader::LearnMore`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html#a95e7aeb16bdd35ee50551d12f908ab7b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html#ae53297e34c5b1f78a85365bd2799f94c) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html#a6404bb0ee6df0477050387c204062bff) does).
3. Tune [`ESearchParamsType`](../../../../doxygen_cpp/classeVision_1_1ESearchParamsType.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1ESearchParamsType.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1ESearchParamsType.html) to be efficient and either:
   * Read only matrix codes that match a sample matrix code,
   * Or read only matrix codes that have the same properties ([`EMatrixCode::GetContrast`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#a08786cfe69b384fbb96a78a9ac0991ae) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#a61997bce2799362ffe430fbfce18f905) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#abb20588c8e72325af368c4a7af3991f7), [`EMatrixCode::GetFamily`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#afb61fc87f0e4f938250585ef7e593477) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#a9e0b3b0cd22c71b57f197d56a032e5d9) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#adb31be08ae9c29095097be1ce762bdad), [`EMatrixCode::GetFlipping`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#a867f2b01b6272c6e9d4e701c9a7acf2b) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#a0d78ab12a487dac90b4344e70b13f649) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#a8fa931c2b79f6588f6edfb858c3205d6), [`EMatrixCode::GetLogicalSize`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#aef484e264d742635af895e6182326fbb) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#aa88802f3ffa675b9aec6ad7fa31786a1) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#a7bf9494688602285fbb15cd19a3ec1bd)) as the learned one,
   * Or disregard a search parameter of the learned matrix code [`EMatrixCodeReader::SetLearnMaskElement`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html#a55705c16973fe94bfb47a23eed6894e6) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html#a9e0ae9a1a11fbbb24a914a9878e9c10b) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html#a33d4790a31faaf5546881bb5c85cb4ac), for example to read only unflipped matrix codes. Just remove the default parameters, then add new ones.
4. Ask [`EMatrixCodeReader`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html) to decode the supplied image.
5. Display the decoded string using [`EMatrixCode::GetDecodedString`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#a9bfc04da8b33e13f972d7535f3147ee9) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#a2f091cf354dbb9c3c93b8cfcfe058765) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#a6391360cd85695bb8835e2c944290d84).
6. Save the state of the reader object using [`EMatrixCodeReader::Save`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html#a0cb68944907421260e17599162aab9b9) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html#a278b076ff885f7ec5a5a44e4048291cf) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html#aa3a2a116d25de6995193d163a64c01b8).

<a id="learning-restore"></a>

## Restoring the state of an EMatrixCodeReader

To restore the state of an [`EMatrixCodeReader`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html) and use it to read a matrix code:

1. Restore the reader state from the given file using [`EMatrixCodeReader::Load`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html#a68addf4ba9ff57e5413b9a417d9ab26c) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html#a734686001992a769bf5de1f4e0670961) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html#a33aed46ff2a5a66241e2fe8ca5ef2309).
2. Use [`EMatrixCodeReader::Read`](../../../../doxygen_cpp/classeVision_1_1EMatrixCodeReader.html#ac5e4a3a293dfe20fbe8853ad9b8aa5e3) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCodeReader.html#a5f80841bd1bc31da1e2a108901a4c3e1) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCodeReader.html#a82bc5109d38832775681a5604ac40eb6) to read the image.
3. Display the decoded string using [`EMatrixCode::GetDecodedString`](../../../../doxygen_cpp/classeVision_1_1EMatrixCode.html#a9bfc04da8b33e13f972d7535f3147ee9) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatrixCode.html#a2f091cf354dbb9c3c93b8cfcfe058765) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatrixCode.html#a6391360cd85695bb8835e2c944290d84).
