# Pattern Learning with ERegion

This code snippet shows how to learn a pattern whose region of interest is defined by an ERegion.

## C++

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

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

// pattern is a 200*200 square but here we are only
// interested in the inner circle
ECircleRegion region(100.f, 100.f, 100.f);
matcher.LearnPattern(&pattern, region);
```

#### 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
EImageBW8 srcImage = new EImageBW8();
EROIBW8 pattern = new EROIBW8();
EMatcher matcher = new EMatcher();
// ...
// Attach the ROI to the source image
// and set its position
pattern.Attach(srcImage);
pattern.SetPlacement(214, 52, 200, 200);

// pattern is a 200*200 square but here we are only
// interested in the inner circle
ECircleRegion region = new ECircleRegion(100.0f, 100.0f, 100.0f);
matcher.LearnPattern(pattern, region);
```

#### 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
src_image = eVision.EImageBW8()
pattern = eVision.EROIBW8()
matcher = eVision.EMatcher()
# ...
# Attach the ROI to the source image
# and set its position
pattern.Attach(src_image)
pattern.SetPlacement(214, 52, 200, 200)

# pattern is a 200*200 square but here we are only
# interested in the inner circle
region = eVision.ECircleRegion(100., 100., 100.)
matcher.LearnPattern(pattern, region)
```

#### 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)
