Matching a template and an image in a resolution pyramid.
The operator mg_match__ is an additional option for the procedure match__ performing a matching of the image Image and the template ImageTemplate. Hereby ImageTemplate will be moved over all points of the region of Image, a matching criterion will be calculated with regard to the parameter Mode and the result values will be stored in ImageMatch.
Of images having been filtered this way, normally only those areas with good matching results are of interest. The size of the area to be searched, i.e. the region of the input image Image, determines decisively the runtime of the matching filter. Therefore it is recommendable to use at first mg_match__ with reduced image resolution in order to determine a "region of interest" in which good matching results can be expected; then in this restricted area only the real matching (see also match__) will be executed with normal resolution.
Hereby the Gauss-pyramids of Image and ImageTemplate will be composed (in particular the corresponding regions will be transformed as well). Then on each level of the resolution pyramids - starting with the startlevel Level - the matching inside the current "region of interest" will be executed. Whereby the "region of interest" on the startlevel is equivalent to the region of the input image Image. After the filtering, a new "region of interest" is determined with the help of a threshold operation and will be transformed on the next resolution level:
threshold__(...:...:0,Threshold,...:), if Mode = 'dfd' threshold__(...:...:Threshold,255,...:), if Mode = 'crosscorrelation'
The final matching in the determined "region of interest" will then be calculated with the highest resolution (Level 0). The output image ImageMatch includes the corresponding filter result and the final "region of interest", which is determined on the result image with the help of a threshold operation.
The operator mg_match__ therefore is not simply a filter, but can also be considered as a member of the class of region transformations.
Image (input_object) |
image(-array) -> object : byte |
Input image. |
ImageTemplate (input_object) |
image -> object : byte |
The domain of this image will be matched with Image. |
ImageMatch (output_object) |
image(-array) -> object : byte |
Result image and result region: values of the matching criterion within the determined "region of interest". | |
Number of elements: ImageMatch == Image |
Mode (input_control) |
string -> string |
Desired matching criterion. | |
Default value: 'dfd' | |
List of values: 'crosscorrelation', 'dfd' |
Level (input_control) |
integer -> integer |
Startlevel in the resolution pyramid (highest resolution: Level 0). | |
Default value: 1 | |
List of values: 0, 1, 2, 3, 4, 5, 6, 7, 8 | |
Suggested values: 0, 1, 2, 3, 4, 5, 6, 7, 8 | |
Restriction: (Level < ld(width(Image))) && (Level < ld(height(Image))) |
Threshold (input_control) |
integer -> integer |
Threshold to determine the "region of interest". | |
Default value: 30 | |
Suggested values: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200, 205, 210, 215, 220, 225, 230, 235, 240, 245, 250 | |
Range of values: 0 <= Threshold <= 255 | |
Minimum increment: 1 | |
Recommended increment: 5 |
read_image(&Image,"affe"); disp_image(Image); draw_rectangle2(&Row,&Column,&Phi,&Length1,&Length2); rectangle2(&Rectangle,Row,Column,Phi,Length1,Length2); reduce_domain(Image,Rectangle,&Template); mg_match__(Image,Template,&ImageMatch,'dfd'1,30); invert(ImageMatch,&ImageInvert); local_max(ImageInvert,&BestFit); disp_region(BestFit);
If the parameter values are correct, the operator mg_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.