best_match ( Image : : MaxError, SubPixel, TemplateID : Row, Column, Error )

Searching the best matching of a template and an image.

The operator best_match performs a matching of the template of TemplateID and Image. Hereby the template will be moved over the points of Image so that the template will lie always inside Image. With regard to the parameter SubPixel, the position will be indicated by subpixel accuracy. The matching criterion (`"displaced frame difference'") is defined as follows:


               SUMu,v {ABS { Image[i-u][j-v] - Template[l-u][c-v] }}     
error[i][j] =  -----------------------------------------------------,
                                    AREA ( Template )                     
The runtime of the procedure depends on the size of the domain of 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 determines the maximal error which the searched position is allowed to show. The lower this value is, the faster the procedure runs.

Row and Column return the position of the best match, whereby Error indicates the average divergence of the grayvalues.


Parameters

Image (input_object)
image(-array) -> object : byte
Input image inside of which the pattern has to be found.

MaxError (input_control)
real -> real
Maximum average difference of the grayvalues.
Default value: 5
Suggested values: 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 15, 17, 20, 30
Range of values: 0 <= MaxError <= 255
Minimum increment: 1
Recommended increment: 1

SubPixel (input_control)
string -> string
Subpixel accuracy in case of 'true'.
Default value: 'false'
List of values: 'true', 'false'

TemplateID (input_control)
integer -> integer
Template number.
Default value: 0

Row (output_control)
number -> real / integer
Row position of the best match.
Default value: 'false'

Column (output_control)
number -> real / integer
Column position of the best match.
Default value: 'false'

Error (output_control)
real -> real
Average divergence of the grayvalues of the best match.
Default value: 'false'


Result

If the parameter values are correct, the operator best_match returns the value TRUE. If the input is empty (no input images are available) the behaviour can be set via set_system(::'no_object_result',<Result>:). If necessary, an exception is raised.


Possible Predecessors

adapt_template, draw_region, draw_rectangle1, reduce_domain


Alternatives

fast_match, fast_mg_match, match__, mg_match__



Copyright © 1996-1997 MVTec Software GmbH