# EasyMatchLearn

| 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/vb.svg) ![](assets/images/sample_programs/applies_to/python.svg)   |
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Required licenses  | **EasyMatch**                                                                                                                                                                                                                                                                   |
| Recommended images | Any image from the folder `Sample Images/EasyMatch`                                                                                                                                                                                                                             |
| Location           | `Matching and Measurement/EasyMatchLearn` and `Console samples/Matching and Measurement` *with Python*                                                                                                                                                                          |

## Purpose

This sample program demonstrates how to:

- Learn a pattern from a region of interest in an image.
- Find one or several instances of that pattern in the same image.

![](assets/images/sample_programs/matching-easymatchlearn.webp)

## Code highlights

1. Learn the pattern defined by the ROI.
   ```c++
   m_Matcher.LearnPattern(m_ROI);
   ```
2. Find the pattern in the Image.
   ```c++
   m_Matcher.Match(m_Source);
   ```
3. Draw the positions of the matches found in the image.
   ```c++
   m_Matcher.DrawPositions(drawAdapter, ERGBColor(0, 255, 0), true);
   ```
