Setting Search Parameters

This code snippet shows how to tune pattern finding search parameters and save them into a file.

C++

#include <eVision/EasyFind/EPatternFinder.h>
using namespace eVision;
// Image constructor
EImageBW8 pattern;
// EPatternFinder constructor
EPatternFinder finder;
// ...
// Learn the pattern
finder.Learn(&pattern);
// Set the maximum number of occurrences
finder.SetMaxInstances(5);
// Set the rotation tolerances
finder.SetAngleTolerance(20.f);
// Set the minimum score
finder.SetMinScore(0.70f);
// Save the finding context into a model file
finder.Save("myModel.fnd");

C#

using eVision;
// Image constructor
EImageBW8 pattern = new EImageBW8();
// EPatternFinder constructor
EPatternFinder finder = new EPatternFinder();
// ...
// Learn the pattern
finder.Learn(pattern);
// Set the maximum number of occurrences
finder.MaxInstances = 5;
// Set the rotation tolerances
finder.AngleTolerance = 20.0f;
// Set the minimum score
finder.MinScore = 0.70f;
// Save the finding context into a model file
finder.Save("myModel.fnd");

Python

import eVision
# Image constructor
pattern = eVision.EImageBW8()
# EPatternFinder constructor
finder = eVision.EPatternFinder()
# ...
# Learn the pattern
finder.Learn(pattern)
# Set the maximum number of occurrences
finder.MaxInstances = 5
# Set the rotation tolerances
finder.AngleTolerance = 20.
# Set the minimum score
finder.MinScore = 0.7
# Save the finding context into a model file
finder.Save("myModel.fnd")