Name
best_match_mgbest_match_mgBestMatchMgbest_match_mgBestMatchMgBestMatchMg — Searching the best grayvalue matches in a pyramid.
Warning
best_match_mgbest_match_mgBestMatchMgbest_match_mgBestMatchMgBestMatchMg is obsolete and is only provided for
reasons of backward compatibility. New applications should use the
shape-based or NCC-based operators instead.
Herror best_match_mg(const Hobject Image, const Hlong TemplateID, double MaxError, const char* SubPixel, const Hlong NumLevels, const Hlong WhichLevels, double* Row, double* Column, double* Error)
Herror T_best_match_mg(const Hobject Image, const Htuple TemplateID, const Htuple MaxError, const Htuple SubPixel, const Htuple NumLevels, const Htuple WhichLevels, Htuple* Row, Htuple* Column, Htuple* Error)
Herror best_match_mg(Hobject Image, const HTuple& TemplateID, const HTuple& MaxError, const HTuple& SubPixel, const HTuple& NumLevels, const HTuple& WhichLevels, double* Row, double* Column, double* Error)
double HImage::BestMatchMg(const HTemplate& TemplateID, const HTuple& MaxError, const HTuple& SubPixel, const HTuple& NumLevels, const HTuple& WhichLevels, double* Column, double* Error) const
double HImageArray::BestMatchMg(const HTemplate& TemplateID, const HTuple& MaxError, const HTuple& SubPixel, const HTuple& NumLevels, const HTuple& WhichLevels, HTuple* Column, HTuple* Error) const
double HTemplate::BestMatchMg(const HImageArray& Image, const HTuple& MaxError, const HTuple& SubPixel, const HTuple& NumLevels, const HTuple& WhichLevels, HTuple* Column, HTuple* Error) const
void BestMatchMg(const HObject& Image, const HTuple& TemplateID, const HTuple& MaxError, const HTuple& SubPixel, const HTuple& NumLevels, const HTuple& WhichLevels, HTuple* Row, HTuple* Column, HTuple* Error)
void HTemplate::BestMatchMg(const HImage& Image, double MaxError, const HString& SubPixel, Hlong NumLevels, const HTuple& WhichLevels, double* Row, double* Column, double* Error) const
void HTemplate::BestMatchMg(const HImage& Image, double MaxError, const HString& SubPixel, Hlong NumLevels, Hlong WhichLevels, double* Row, double* Column, double* Error) const
void HTemplate::BestMatchMg(const HImage& Image, double MaxError, const char* SubPixel, Hlong NumLevels, Hlong WhichLevels, double* Row, double* Column, double* Error) const
void HImage::BestMatchMg(const HTemplate& TemplateID, double MaxError, const HString& SubPixel, Hlong NumLevels, const HTuple& WhichLevels, double* Row, double* Column, double* Error) const
void HImage::BestMatchMg(const HTemplate& TemplateID, double MaxError, const HString& SubPixel, Hlong NumLevels, Hlong WhichLevels, double* Row, double* Column, double* Error) const
void HImage::BestMatchMg(const HTemplate& TemplateID, double MaxError, const char* SubPixel, Hlong NumLevels, Hlong WhichLevels, double* Row, double* Column, double* Error) const
void HOperatorSetX.BestMatchMg(
[in] IHUntypedObjectX* Image, [in] VARIANT TemplateID, [in] VARIANT MaxError, [in] VARIANT SubPixel, [in] VARIANT NumLevels, [in] VARIANT WhichLevels, [out] VARIANT* Row, [out] VARIANT* Column, [out] VARIANT* Error)
double HTemplateX.BestMatchMg(
[in] IHImageX* Image, [in] double MaxError, [in] BSTR SubPixel, [in] Hlong NumLevels, [in] VARIANT WhichLevels, [out] double* Column, [out] double* Error)
double HImageX.BestMatchMg(
[in] IHTemplateX* TemplateID, [in] double MaxError, [in] BSTR SubPixel, [in] Hlong NumLevels, [in] VARIANT WhichLevels, [out] double* Column, [out] double* Error)
static void HOperatorSet.BestMatchMg(HObject image, HTuple templateID, HTuple maxError, HTuple subPixel, HTuple numLevels, HTuple whichLevels, out HTuple row, out HTuple column, out HTuple error)
void HTemplate.BestMatchMg(HImage image, double maxError, string subPixel, int numLevels, HTuple whichLevels, out double row, out double column, out double error)
void HTemplate.BestMatchMg(HImage image, double maxError, string subPixel, int numLevels, int whichLevels, out double row, out double column, out double error)
void HImage.BestMatchMg(HTemplate templateID, double maxError, string subPixel, int numLevels, HTuple whichLevels, out double row, out double column, out double error)
void HImage.BestMatchMg(HTemplate templateID, double maxError, string subPixel, int numLevels, int whichLevels, out double row, out double column, out double error)
best_match_mgbest_match_mgBestMatchMgbest_match_mgBestMatchMgBestMatchMg applies gray value matching using an
image pyramid.
best_match_mgbest_match_mgBestMatchMgbest_match_mgBestMatchMgBestMatchMg works analogously to best_matchbest_matchBestMatchbest_matchBestMatchBestMatch,
but it is faster due to the use of a pyramid.
Input is an image with an optionally reduced domain. The template is
searched within those points of the domain of the image, in which
the model lies completely within the image. This means that the
model will not be found if it extends beyond the borders of the
image. The parameter MaxErrorMaxErrorMaxErrorMaxErrorMaxErrormaxError specifies the maximum error
for template matching.
Using smaller values results in a reduced runtime but it is possible
that the pattern might be missed.
The value of MaxErrorMaxErrorMaxErrorMaxErrorMaxErrormaxError has to be chosen larger compared with
best_matchbest_matchBestMatchbest_matchBestMatchBestMatch, because the error at higher levels
of the pyramid is often larger.
SubPixelSubPixelSubPixelSubPixelSubPixelsubPixel specifies if the result is calculated
with sub pixel accuracy or not.
A value of 1 for NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels
results in an operator similar to best_matchbest_matchBestMatchbest_matchBestMatchBestMatch,
i.e. only the original gray values are used.
For values larger than 1,
the algorithm starts at the lowest resolution and searches
for a position with the lowest matching error.
At the next higher resolution this position is refined.
This is continued up to the maximum resolution
(WhichLevelsWhichLevelsWhichLevelsWhichLevelsWhichLevelswhichLevels = 'all'"all""all""all""all""all").
As an alternative Method the mode
WhichLevelsWhichLevelsWhichLevelsWhichLevelsWhichLevelswhichLevels with value 'original'"original""original""original""original""original" can be used.
In this case not only the position with the lowest error
but all points below MaxErrorMaxErrorMaxErrorMaxErrorMaxErrormaxError are analyzed further on
in the next higher resolution.
This method is slower but it is more stable and the possibility
to miss the correct position is very low.
In this case it is often possible to start with a lower resolution (higher
level in Pyramid, i.e. larger value for NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels)
which leads to a reduced runtime.
Besides the values 'all'"all""all""all""all""all" and 'original'"original""original""original""original""original"
for WhichLevelsWhichLevelsWhichLevelsWhichLevelsWhichLevelswhichLevels
you can specify the pyramid level explicitly
where to switch between a “match all” and the ”best match”.
Here 0 corresponds to 'original'"original""original""original""original""original"
and NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels - 1 is equivalent to 'all'"all""all""all""all""all". A value
in-between is in most cases a good compromise between speed
and a stable detection. A larger value for WhichLevelsWhichLevelsWhichLevelsWhichLevelsWhichLevelswhichLevels
results in a reduced runtime, a smaller value
results in a more stable detection.
The value of NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels has to be equal or smaller than
the value used to create the template.
The position of the found matching position is
returned in RowRowRowRowRowrow and ColumnColumnColumnColumnColumncolumn.
The corresponding error is given in ErrorErrorErrorErrorErrorerror.
If no point below MaxErrorMaxErrorMaxErrorMaxErrorMaxErrormaxError is found
a value of 255 for ErrorErrorErrorErrorErrorerror and
0 for RowRowRowRowRowrow and ColumnColumnColumnColumnColumncolumn
is returned. If the desired object is missed (no object found
or wrong position) you have to set MaxErrorMaxErrorMaxErrorMaxErrorMaxErrormaxError higher
or WhichLevelsWhichLevelsWhichLevelsWhichLevelsWhichLevelswhichLevels lower. Check also if the
illumination has changed (see set_offset_templateset_offset_templateSetOffsetTemplateset_offset_templateSetOffsetTemplateSetOffsetTemplate).
The maximum error of the position (without noise) is 0.1 pixel.
The average error is 0.03 pixel.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
Input image inside of which the pattern has to
be found.
Maximal average difference of the grayvalues.
Default value: 30.0
Suggested values: 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 9.0, 11.0, 15.0, 17.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0
Typical range of values: 0
≤
MaxError
MaxError
MaxError
MaxError
MaxError
maxError
≤
255
Minimum increment: 1
Recommended increment: 3
Exactness in subpixels in case of 'true'"true""true""true""true""true".
Default value:
'false'
"false"
"false"
"false"
"false"
"false"
List of values: 'false'"false""false""false""false""false", 'true'"true""true""true""true""true"
Number of the used resolution levels.
Default value: 4
Suggested values: 1, 2, 3, 4, 5, 6
Resolution level up to which the
method “best match” is used.
Default value: 2
Suggested values: 'all'"all""all""all""all""all", 'original'"original""original""original""original""original", 0, 1, 2, 3, 4, 5, 6
Row position of the best match.
Column position of the best match.
Average divergence of the grayvalues in the
best match.
If the parameter values are correct, the operator best_match_mgbest_match_mgBestMatchMgbest_match_mgBestMatchMgBestMatchMg
returns the value 2 (H_MSG_TRUE).
If the input is empty (no input images are available) the behaviour can
be set via set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>).
If necessary, an exception is raised.
create_templatecreate_templateCreateTemplatecreate_templateCreateTemplateCreateTemplate,
read_templateread_templateReadTemplateread_templateReadTemplateReadTemplate,
adapt_templateadapt_templateAdaptTemplateadapt_templateAdaptTemplateAdaptTemplate,
draw_regiondraw_regionDrawRegiondraw_regionDrawRegionDrawRegion,
draw_rectangle1draw_rectangle1DrawRectangle1draw_rectangle1DrawRectangle1DrawRectangle1,
reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain,
set_reference_templateset_reference_templateSetReferenceTemplateset_reference_templateSetReferenceTemplateSetReferenceTemplate,
set_offset_templateset_offset_templateSetOffsetTemplateset_offset_templateSetOffsetTemplateSetOffsetTemplate
fast_matchfast_matchFastMatchfast_matchFastMatchFastMatch,
fast_match_mgfast_match_mgFastMatchMgfast_match_mgFastMatchMgFastMatchMg,
best_matchbest_matchBestMatchbest_matchBestMatchBestMatch,
best_match_pre_mgbest_match_pre_mgBestMatchPreMgbest_match_pre_mgBestMatchPreMgBestMatchPreMg,
best_match_rotbest_match_rotBestMatchRotbest_match_rotBestMatchRotBestMatchRot,
best_match_rot_mgbest_match_rot_mgBestMatchRotMgbest_match_rot_mgBestMatchRotMgBestMatchRotMg,
exhaustive_matchexhaustive_matchExhaustiveMatchexhaustive_matchExhaustiveMatchExhaustiveMatch,
exhaustive_match_mgexhaustive_match_mgExhaustiveMatchMgexhaustive_match_mgExhaustiveMatchMgExhaustiveMatchMg
Matching