# Pattern Finding and Retrieving Results

This code snippet shows how to perform pattern finding operations and retrieve the results.

## C++

```cpp
#include <eVision/EasyFind/EPatternFinder.h>
```

```cpp
using namespace eVision;
// 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 = (int)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();
```

#### SEE ALSO
[`EPatternFinder::Load`](../../../../doxygen_cpp/classeVision_1_1EPatternFinder.html#a6b66dc9bd9efbe5d7cc0d3c8d06dd473) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EPatternFinder.html#a082d1d9b9dba58c895fe005de12e0107) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EPatternFinder.html#af29f8f444e583cea0dc3b175890c81bb), [`EPatternFinder::Find`](../../../../doxygen_cpp/classeVision_1_1EPatternFinder.html#aeeb160cde9343ffc0d8583ac1d330e4d) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EPatternFinder.html#a9c35c544243729d9907eb708f7d2a0e2) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EPatternFinder.html#a44780e599d160cbb5f8e405042ace771), [`EFoundPattern::GetScore`](../../../../doxygen_cpp/classeVision_1_1EFoundPattern.html#a26fc1f189d2b207f0d9e681296b5e142) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EFoundPattern.html#afffb43eccd8aee7cb7c747d1e53c0964) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EFoundPattern.html#a57ae1622643621d5c1e9e9ed3c1fffee), [`EFoundPattern::GetCenter`](../../../../doxygen_cpp/classeVision_1_1EFoundPattern.html#add106e12cba37e0bc4d2eaa55e673c76) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EFoundPattern.html#a4044e9a13bb3d8be3cde2241825d3c5b) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EFoundPattern.html#a1b30958eac9216d2bbb3610e6ff0cf3c)

## C#

```cs
using eVision;
```

```cs
// 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;
```

#### SEE ALSO
[`EPatternFinder.Load`](../../../../doxygen_cs/classeVision_1_1EPatternFinder.html#a082d1d9b9dba58c895fe005de12e0107) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EPatternFinder.html#a6b66dc9bd9efbe5d7cc0d3c8d06dd473) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EPatternFinder.html#af29f8f444e583cea0dc3b175890c81bb), [`EPatternFinder.Find`](../../../../doxygen_cs/classeVision_1_1EPatternFinder.html#a9c35c544243729d9907eb708f7d2a0e2) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EPatternFinder.html#aeeb160cde9343ffc0d8583ac1d330e4d) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EPatternFinder.html#a44780e599d160cbb5f8e405042ace771), [`EFoundPattern.Score`](../../../../doxygen_cs/classeVision_1_1EFoundPattern.html#afffb43eccd8aee7cb7c747d1e53c0964) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EFoundPattern.html#a26fc1f189d2b207f0d9e681296b5e142) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EFoundPattern.html#a57ae1622643621d5c1e9e9ed3c1fffee), [`EFoundPattern.Center`](../../../../doxygen_cs/classeVision_1_1EFoundPattern.html#a4044e9a13bb3d8be3cde2241825d3c5b) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EFoundPattern.html#add106e12cba37e0bc4d2eaa55e673c76) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EFoundPattern.html#a1b30958eac9216d2bbb3610e6ff0cf3c)

## Python

```py
import eVision
# Image constructor
src_image = eVision.EImageBW8()
# EPatternFinder constructor
finder = eVision.EPatternFinder()
# ...
# Load a model file
finder.Load("myModel.fnd")
# Perform the pattern finding
found_pattern = finder.Find(src_image)
# Retrieve the number of instances
num_instances = len(found_pattern)
# Retrieve the score and the
# position of the first instance
score = found_pattern[0].Score
centerX = found_pattern[0].Center.X
centerY = found_pattern[0].Center.Y
```

#### SEE ALSO
[`EPatternFinder.Load`](../../../../doxygen_python/classeVision_1_1EPatternFinder.html#af29f8f444e583cea0dc3b175890c81bb) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EPatternFinder.html#a6b66dc9bd9efbe5d7cc0d3c8d06dd473) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EPatternFinder.html#a082d1d9b9dba58c895fe005de12e0107), [`EPatternFinder.Find`](../../../../doxygen_python/classeVision_1_1EPatternFinder.html#a44780e599d160cbb5f8e405042ace771) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EPatternFinder.html#aeeb160cde9343ffc0d8583ac1d330e4d) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EPatternFinder.html#a9c35c544243729d9907eb708f7d2a0e2), [`EFoundPattern.Score`](../../../../doxygen_python/classeVision_1_1EFoundPattern.html#a57ae1622643621d5c1e9e9ed3c1fffee) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EFoundPattern.html#a26fc1f189d2b207f0d9e681296b5e142) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EFoundPattern.html#afffb43eccd8aee7cb7c747d1e53c0964), [`EFoundPattern.Center`](../../../../doxygen_python/classeVision_1_1EFoundPattern.html#a1b30958eac9216d2bbb3610e6ff0cf3c) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EFoundPattern.html#add106e12cba37e0bc4d2eaa55e673c76) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EFoundPattern.html#a4044e9a13bb3d8be3cde2241825d3c5b)
