# Pattern Learning

This code snippet shows how to learn a pattern defined by a region of interest (ROI).

## C++

```cpp
#include <eVision/EasyMatch/EMatcher.h>
```

```cpp
using namespace eVision;
// Image constructor
EImageBW8 srcImage;
// ROI constructor
EROIBW8 pattern;
// EMatcher constructor
EMatcher matcher;
// ...
// Attach the ROI to the source image
// and set its position
pattern.Attach(&srcImage);
pattern.SetPlacement(214, 52, 200, 200);
// Learn the pattern
matcher.LearnPattern(&pattern);
```

#### SEE ALSO
[`EMatcher::LearnPattern`](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#acefe7822d00bd66e29361fe6d9781421) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a75bc52a9ce8490d5606986abe5b118dc) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#abb5a92bb163e68d8fb98c1525a5ea632)

## C#

```cs
using eVision;
```

```cs
// Image constructor
EImageBW8 srcImage = new EImageBW8();
// ROI constructor
EROIBW8 pattern = new EROIBW8();
// EMatcher constructor
EMatcher matcher = new EMatcher();
// ...
// Attach the ROI to the source image
// and set its position
pattern.Attach(srcImage);
pattern.SetPlacement(214, 52, 200, 200);
// Learn the pattern
matcher.LearnPattern(pattern);
```

#### SEE ALSO
[`EMatcher.LearnPattern`](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a75bc52a9ce8490d5606986abe5b118dc) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#acefe7822d00bd66e29361fe6d9781421) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#abb5a92bb163e68d8fb98c1525a5ea632)

## Python

```py
import eVision
# Image constructor
src_image = eVision.EImageBW8()
# ROI constructor
pattern = eVision.EROIBW8()
# EMatcher constructor
matcher = eVision.EMatcher()
# ...
# Attach the ROI to the source image
# and set its position
pattern.Attach(src_image)
pattern.SetPlacement(214, 52, 200, 200)
# Learn the pattern
matcher.LearnPattern(pattern)
```

#### SEE ALSO
[`EMatcher.LearnPattern`](../../../../doxygen_python/classeVision_1_1EMatcher.html#abb5a92bb163e68d8fb98c1525a5ea632) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#acefe7822d00bd66e29361fe6d9781421) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a75bc52a9ce8490d5606986abe5b118dc)
