# Setting Search Parameters

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

## C++

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

```cpp
using namespace eVision;
// Image constructor
EImageBW8 pattern;
// EMatcher constructor
EMatcher matcher;
// ...
// Learn the pattern
matcher.LearnPattern(&pattern);
// Set the maximum number of occurrences
matcher.SetMaxPositions(5);
// Set the rotation tolerances
matcher.SetMinAngle(-20.f);
matcher.SetMaxScale(20.f);
// Enable sub-pixel accuracy
matcher.SetInterpolate(true);
// Set the minimum score
matcher.SetMinScore(0.70f);
// Save the matching context into a model file
matcher.Save("myModel.mch");
```

#### SEE ALSO
[`EMatcher::SetMaxPositions`](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a91d5e21854a1c5b7c38c72f3cf36c128) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a25c3b43e17b0c17a2f8edaddfcb05978) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#a4219c172ba67919eacc094628b54c35b), [`EMatcher::SetMinAngle`](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#afcaaecbe765251da989c67fff90fe5b9) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a2944ac20d4f2d978f4c379a9163a8574) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#afb4f6ed7bd7790700f0329826538e250), [`EMatcher::SetMaxAngle`](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a5ad619139960fafbb9ee13aaf389d928) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#aae4523e58864b586d5520f8b743cb278) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#a5d130e77b05453ddf5c148f7541819a7), [`EMatcher::SetMinScore`](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a3f93c975984fca9a4a508a85e5ba2423) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#abcdd9a9bad024b98e2baac72910327b2) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#a29ee01a817e64cccb13d07c1909bfcda), [`EMatcher::SetInterpolate`](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a066fd069ea1ba3129691655ace9533e3) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#acb203f642ac1a3eb84116d245dcf2ac6) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#afd9d66fcd0af6a07b0aef174c99a7ae4), [`EMatcher::Save`](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a2690f5e9aa8e5ebb95c79b9a4b283eda) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a149489dadfed73e36f4deff7c72849d7) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#aed3d59f45a4b39784e4e91d788b7ab43)

## C#

```cs
using eVision;
```

```cs
// Image constructor
EImageBW8 pattern = new EImageBW8();
// EMatcher constructor
EMatcher matcher = new EMatcher();
// ...
// Learn the pattern
matcher.LearnPattern(pattern);
// Set the maximum number of occurrences
matcher.MaxPositions = 5;
// Set the rotation tolerances
matcher.MinAngle = -20.0f;
matcher.MaxAngle = 20.0f;
// Enable sub-pixel accuracy
matcher.Interpolate = true;
// Set the minimum score
matcher.MinScore = 0.70f;
// Save the matching context into a model file
matcher.Save("myModel.mch");
```

#### SEE ALSO
[`EMatcher.MaxPositions`](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a25c3b43e17b0c17a2f8edaddfcb05978) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a47969310e18951eea969bd1e60718e49) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#a4219c172ba67919eacc094628b54c35b), [`EMatcher.MinAngle`](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a2944ac20d4f2d978f4c379a9163a8574) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a7b26d938b010eee894d9d1d4a0223e89) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#afb4f6ed7bd7790700f0329826538e250), [`EMatcher.MaxAngle`](../../../../doxygen_cs/classeVision_1_1EMatcher.html#aae4523e58864b586d5520f8b743cb278) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a206f053ea9ff0a2b3070f8ff076066b7) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#a5d130e77b05453ddf5c148f7541819a7), [`EMatcher.MinScore`](../../../../doxygen_cs/classeVision_1_1EMatcher.html#abcdd9a9bad024b98e2baac72910327b2) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#ac1f2a82c7c3c2903f6c66626d625fc25) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#a29ee01a817e64cccb13d07c1909bfcda), [`EMatcher.Interpolate`](../../../../doxygen_cs/classeVision_1_1EMatcher.html#acb203f642ac1a3eb84116d245dcf2ac6) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#aa1667a01512d25f38026f8280b6084f6) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#afd9d66fcd0af6a07b0aef174c99a7ae4), [`EMatcher.Save`](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a149489dadfed73e36f4deff7c72849d7) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a2690f5e9aa8e5ebb95c79b9a4b283eda) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EMatcher.html#aed3d59f45a4b39784e4e91d788b7ab43)

## Python

```py
import eVision
# Image constructor
pattern = eVision.EImageBW8()
# EMatcher constructor
matcher = eVision.EMatcher()
# ...
# Learn the pattern
matcher.LearnPattern(pattern)
# Set the maximum number of occurrences
matcher.MaxPositions = 5
# Set the rotation tolerances
matcher.MinAngle = -20.
matcher.MaxAngle = 20.
# Enable sub-pixel accuracy
matcher.Interpolate = True
# Set the minimum score
matcher.MinScore = 0.7
# Save the matching context into a model file
matcher.Save("myModel.mch")
```

#### SEE ALSO
[`EMatcher.MaxPositions`](../../../../doxygen_python/classeVision_1_1EMatcher.html#a4219c172ba67919eacc094628b54c35b) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a47969310e18951eea969bd1e60718e49) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a25c3b43e17b0c17a2f8edaddfcb05978), [`EMatcher.MinAngle`](../../../../doxygen_python/classeVision_1_1EMatcher.html#afb4f6ed7bd7790700f0329826538e250) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a7b26d938b010eee894d9d1d4a0223e89) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a2944ac20d4f2d978f4c379a9163a8574), [`EMatcher.MaxAngle`](../../../../doxygen_python/classeVision_1_1EMatcher.html#a5d130e77b05453ddf5c148f7541819a7) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a206f053ea9ff0a2b3070f8ff076066b7) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#aae4523e58864b586d5520f8b743cb278), [`EMatcher.MinScore`](../../../../doxygen_python/classeVision_1_1EMatcher.html#a29ee01a817e64cccb13d07c1909bfcda) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#ac1f2a82c7c3c2903f6c66626d625fc25) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#abcdd9a9bad024b98e2baac72910327b2), [`EMatcher.Interpolate`](../../../../doxygen_python/classeVision_1_1EMatcher.html#afd9d66fcd0af6a07b0aef174c99a7ae4) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#aa1667a01512d25f38026f8280b6084f6) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#acb203f642ac1a3eb84116d245dcf2ac6), [`EMatcher.Save`](../../../../doxygen_python/classeVision_1_1EMatcher.html#aed3d59f45a4b39784e4e91d788b7ab43) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EMatcher.html#a2690f5e9aa8e5ebb95c79b9a4b283eda) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EMatcher.html#a149489dadfed73e36f4deff7c72849d7)
