Pattern Learning with ERegion¶
This code snippet shows how to learn a pattern whose region of interest is defined by an ERegion.
C++¶
#include <eVision/EasyMatch/EMatcher.h>
#include <eVision/Easy/ECircleRegion.h>
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
C#¶
using eVision;
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
Python¶
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