best_match T_best_match BestMatch BestMatch (Operator)
Name
best_match T_best_match BestMatch BestMatch
— Searching the best matching of a template and an image.
Warning
best_match best_match BestMatch BestMatch BestMatch
is obsolete and is only provided for
reasons of backward compatibility. New applications should use the
shape-based or NCC-based operators instead.
Signature
void BestMatch (const HObject& Image , const HTuple& TemplateID , const HTuple& MaxError , const HTuple& SubPixel , HTuple* Row , HTuple* Column , HTuple* Error )
void HTemplate ::BestMatch (const HImage& Image , double MaxError , const HString& SubPixel , HTuple* Row , HTuple* Column , HTuple* Error ) const
void HTemplate ::BestMatch (const HImage& Image , double MaxError , const HString& SubPixel , double* Row , double* Column , double* Error ) const
void HTemplate ::BestMatch (const HImage& Image , double MaxError , const char* SubPixel , double* Row , double* Column , double* Error ) const
void HTemplate ::BestMatch (const HImage& Image , double MaxError , const wchar_t* SubPixel , double* Row , double* Column , double* Error ) const
(Windows only)
void HImage ::BestMatch (const HTemplate& TemplateID , double MaxError , const HString& SubPixel , HTuple* Row , HTuple* Column , HTuple* Error ) const
void HImage ::BestMatch (const HTemplate& TemplateID , double MaxError , const HString& SubPixel , double* Row , double* Column , double* Error ) const
void HImage ::BestMatch (const HTemplate& TemplateID , double MaxError , const char* SubPixel , double* Row , double* Column , double* Error ) const
void HImage ::BestMatch (const HTemplate& TemplateID , double MaxError , const wchar_t* SubPixel , double* Row , double* Column , double* Error ) const
(Windows only)
static void HOperatorSet .BestMatch (HObject image , HTuple templateID , HTuple maxError , HTuple subPixel , out HTuple row , out HTuple column , out HTuple error )
void HTemplate .BestMatch (HImage image , double maxError , string subPixel , out HTuple row , out HTuple column , out HTuple error )
void HTemplate .BestMatch (HImage image , double maxError , string subPixel , out double row , out double column , out double error )
void HImage .BestMatch (HTemplate templateID , double maxError , string subPixel , out HTuple row , out HTuple column , out HTuple error )
void HImage .BestMatch (HTemplate templateID , double maxError , string subPixel , out double row , out double column , out double error )
Description
The operator best_match best_match BestMatch BestMatch BestMatch
performs a matching of the template
of TemplateID TemplateID TemplateID TemplateID templateID
and Image Image Image Image image
.
Hereby the template will be moved over the points of Image Image Image Image image
so that the template will lie always inside Image Image Image Image image
.
best_match best_match BestMatch BestMatch BestMatch
works similar to fast_match fast_match FastMatch FastMatch FastMatch
, with the
exception, that each time a better match is found the value
of MaxError MaxError MaxError MaxError maxError
is internally updated to a lower value
to reduce runtime.
With regard to the parameter SubPixel SubPixel SubPixel SubPixel subPixel
, the position will
be indicated by subpixel accuracy.
The matching criterion (“displaced frame difference”)
is defined as follows:
The runtime of the operator depends on the size of the domain of
Image Image Image Image image
.
Therefore it is important to restrict the domain as far as possible,
i.e. to apply the operator only in a very confined “region of interest”.
The parameter MaxError MaxError MaxError MaxError maxError
determines the maximal error which the
searched position is allowed to have at most.
The lower this value is, the faster the operator runs.
Row Row Row Row row
and Column Column Column Column column
return the position of the best match,
whereby Error Error Error Error error
indicates the average difference of the grayvalues.
If no position with an error below MaxError MaxError MaxError MaxError maxError
was found
the position (0,0) and a matching result of 255 for Error Error Error Error error
are returned. In this case MaxError MaxError MaxError MaxError maxError
has to be set
larger.
The maximum error of the position (without noise) is 0.1 pixel.
The average error is 0.03 pixel.
Execution Information
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Automatically parallelized on tuple level.
Parameters
Image Image Image Image image
(input_object) singlechannelimage(-array) →
object HImage HImage Hobject (byte)
Input image inside of which the pattern has to
be found.
TemplateID TemplateID TemplateID TemplateID templateID
(input_control) template →
HTemplate , HTuple HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Template number.
MaxError MaxError MaxError MaxError maxError
(input_control) real →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Maximum average difference of the grayvalues.
Default value: 20.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
≤
255
Minimum increment: 1
Recommended increment: 3
SubPixel SubPixel SubPixel SubPixel subPixel
(input_control) string →
HTuple HTuple Htuple (string) (string ) (HString ) (char* )
Subpixel accuracy in case of 'true' "true" "true" "true" "true" .
Default value:
'false'
"false"
"false"
"false"
"false"
List of values: 'false' "false" "false" "false" "false" , 'true' "true" "true" "true" "true"
Row Row Row Row row
(output_control) point.y(-array) →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Row position of the best match.
Column Column Column Column column
(output_control) point.x(-array) →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Column position of the best match.
Error Error Error Error error
(output_control) real(-array) →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Average divergence of the grayvalues of the
best match.
Result
If the parameter values are correct, the operator best_match best_match BestMatch BestMatch BestMatch
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>) SetSystem("no_object_result",<Result>) SetSystem("no_object_result",<Result>)
.
If necessary, an exception is raised.
Possible Predecessors
create_template create_template CreateTemplate CreateTemplate CreateTemplate
,
read_template read_template ReadTemplate ReadTemplate ReadTemplate
,
set_offset_template set_offset_template SetOffsetTemplate SetOffsetTemplate SetOffsetTemplate
,
set_reference_template set_reference_template SetReferenceTemplate SetReferenceTemplate SetReferenceTemplate
,
adapt_template adapt_template AdaptTemplate AdaptTemplate AdaptTemplate
,
draw_region draw_region DrawRegion DrawRegion DrawRegion
,
draw_rectangle1 draw_rectangle1 DrawRectangle1 DrawRectangle1 DrawRectangle1
,
reduce_domain reduce_domain ReduceDomain ReduceDomain ReduceDomain
Alternatives
fast_match fast_match FastMatch FastMatch FastMatch
,
fast_match_mg fast_match_mg FastMatchMg FastMatchMg FastMatchMg
,
best_match_mg best_match_mg BestMatchMg BestMatchMg BestMatchMg
,
best_match_pre_mg best_match_pre_mg BestMatchPreMg BestMatchPreMg BestMatchPreMg
,
best_match_rot best_match_rot BestMatchRot BestMatchRot BestMatchRot
,
best_match_rot_mg best_match_rot_mg BestMatchRotMg BestMatchRotMg BestMatchRotMg
,
exhaustive_match exhaustive_match ExhaustiveMatch ExhaustiveMatch ExhaustiveMatch
,
exhaustive_match_mg exhaustive_match_mg ExhaustiveMatchMg ExhaustiveMatchMg ExhaustiveMatchMg
Module
Matching