best_match T_best_match BestMatch BestMatch best_match (Operator)
Name
best_match T_best_match BestMatch BestMatch best_match
— Searching the best matching of a template and an image.
Warning
best_match best_match BestMatch BestMatch BestMatch best_match
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 )
def best_match (image : HObject, template_id : HHandle, max_error : float, sub_pixel : str) -> Tuple[Sequence[float], Sequence[float], Sequence[float]]
def best_match_s (image : HObject, template_id : HHandle, max_error : float, sub_pixel : str) -> Tuple[float, float, float]
Description
The operator best_match best_match BestMatch BestMatch BestMatch best_match
performs a matching of the template
of TemplateID TemplateID TemplateID TemplateID templateID template_id
and Image Image Image Image image image
.
Hereby the template will be moved over the points of Image Image Image Image image image
so that the template will lie always inside Image Image Image Image image image
.
best_match best_match BestMatch BestMatch BestMatch best_match
works similar to fast_match fast_match FastMatch FastMatch FastMatch fast_match
, with the
exception, that each time a better match is found the value
of MaxError MaxError MaxError MaxError maxError max_error
is internally updated to a lower value
to reduce runtime.
With regard to the parameter SubPixel SubPixel SubPixel SubPixel subPixel sub_pixel
, 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 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 max_error
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 row
and Column Column Column Column column column
return the position of the best match,
whereby Error Error Error Error error error
indicates the average difference of the gray values.
If no position with an error below MaxError MaxError MaxError MaxError maxError max_error
was found
the position (0,0) and a matching result of 255 for Error Error Error Error error error
are returned. In this case MaxError MaxError MaxError MaxError maxError max_error
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 image
(input_object) singlechannelimage(-array) →
object HImage HObject HImage Hobject (byte)
Input image inside of which the pattern has to
be found.
TemplateID TemplateID TemplateID TemplateID templateID template_id
(input_control) template →
HTemplate , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Template number.
MaxError MaxError MaxError MaxError maxError max_error
(input_control) real →
HTuple float HTuple Htuple (real) (double ) (double ) (double )
Maximum average difference of the gray values.
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
max_error
≤
255
Minimum increment: 1
Recommended increment: 3
SubPixel SubPixel SubPixel SubPixel subPixel sub_pixel
(input_control) string →
HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Subpixel accuracy 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"
Row Row Row Row row row
(output_control) point.y(-array) →
HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Row position of the best match.
Column Column Column Column column column
(output_control) point.x(-array) →
HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Column position of the best match.
Error Error Error Error error error
(output_control) real(-array) →
HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Average divergence of the gray values of the
best match.
Result
If the parameter values are correct, the operator best_match best_match BestMatch BestMatch BestMatch best_match
returns the value TRUE.
If the input is empty (no input images are available) the behavior 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>) set_system("no_object_result",<Result>)
.
If necessary, an exception is raised.
Possible Predecessors
create_template create_template CreateTemplate CreateTemplate CreateTemplate create_template
,
read_template read_template ReadTemplate ReadTemplate ReadTemplate read_template
,
set_offset_template set_offset_template SetOffsetTemplate SetOffsetTemplate SetOffsetTemplate set_offset_template
,
set_reference_template set_reference_template SetReferenceTemplate SetReferenceTemplate SetReferenceTemplate set_reference_template
,
adapt_template adapt_template AdaptTemplate AdaptTemplate AdaptTemplate adapt_template
,
draw_region draw_region DrawRegion DrawRegion DrawRegion draw_region
,
draw_rectangle1 draw_rectangle1 DrawRectangle1 DrawRectangle1 DrawRectangle1 draw_rectangle1
,
reduce_domain reduce_domain ReduceDomain ReduceDomain ReduceDomain reduce_domain
Alternatives
fast_match fast_match FastMatch FastMatch FastMatch fast_match
,
fast_match_mg fast_match_mg FastMatchMg FastMatchMg FastMatchMg fast_match_mg
,
best_match_mg best_match_mg BestMatchMg BestMatchMg BestMatchMg best_match_mg
,
best_match_pre_mg best_match_pre_mg BestMatchPreMg BestMatchPreMg BestMatchPreMg best_match_pre_mg
,
best_match_rot best_match_rot BestMatchRot BestMatchRot BestMatchRot best_match_rot
,
best_match_rot_mg best_match_rot_mg BestMatchRotMg BestMatchRotMg BestMatchRotMg best_match_rot_mg
,
exhaustive_match exhaustive_match ExhaustiveMatch ExhaustiveMatch ExhaustiveMatch exhaustive_match
,
exhaustive_match_mg exhaustive_match_mg ExhaustiveMatchMg ExhaustiveMatchMg ExhaustiveMatchMg exhaustive_match_mg
Module
Matching