Pattern Finding and Retrieving Results
Functional Guide | Reference: Load, Find, GetScore, GetCenter
/////////////////////////////////////////////////////
// This code snippet shows how to perform pattern //
// finding operations and retrieve the results. //
/////////////////////////////////////////////////////
// Image constructor
EImageBW8 srcImage;
// EPatternFinder constructor
EPatternFinder finder;
// EFoundPattern constructor
std::vector<EFoundPattern> foundPattern;
// ...
// Load a model file
finder.Load("myModel.fnd");
// Perform the pattern finding
foundPattern= finder.Find(&srcImage);
// Retrieve the number of instances
int numInstances= foundPattern.size();
// Retrieve the score and the
// position of the first instance
float score= foundPattern[0].GetScore();
float centerX= foundPattern[0].GetCenter().GetX();
float centerY= foundPattern[0].GetCenter().GetY();
'/////////////////////////////////////////////////////
'// This code snippet shows how to perform pattern //
'// finding operations and retrieve the results. //
'/////////////////////////////////////////////////////
' Image constructor
Dim srcImage As New EImageBW8
' EPatternFinder constructor
Dim finder As New EPatternFinder
' EFoundPattern constructor
Dim foundPattern() As EFoundPattern
' ...
' Load a model file
finder.Load "myModel.fnd"
' Perform the pattern finding
foundPattern = finder.Find(srcImage)
' Retrieve the number of instances
Dim numInstances As Long
For numInstances = 0 To UBound(foundPattern)
Next
' Retrieve the score and the
' position of the first instance
Dim score As Single
Dim centerX As Single
Dim centerY As Single
score = foundPattern(0).score
centerX = foundPattern(0).center.x
centerY = foundPattern(0).center.y
/////////////////////////////////////////////////////
// This code snippet shows how to perform pattern //
// finding operations and retrieve the results. //
/////////////////////////////////////////////////////
// Image constructor
EImageBW8 srcImage= new EImageBW8();
// EPatternFinder constructor
EPatternFinder finder= new EPatternFinder();
// EFoundPattern constructor
EFoundPattern[] foundPattern= null;
// ...
// Load a model file
finder.Load("myModel.fnd");
// Perform the pattern finding
foundPattern= finder.Find(srcImage);
// Retrieve the number of instances
int numInstances= foundPattern.Length;
// Retrieve the score and the
// position of the first instance
float score= foundPattern[0].Score;
float centerX= foundPattern[0].Center.X;
float centerY= foundPattern[0].Center.Y;