Template Match

Block Category: Matching

Input Image Format

Input Image Requirements: None

Description: The Template Match block finds the single highest matching area of a template image within a source image. To find the matching area, the template image is moved over the source image one pixel at a time.

Output from the Template Match block is the resulting image and the x,y coordinates of the upper right corner of the matching area. You can also control whether the matching area is marked with a rectangle in the resulting image.

Color: Specifies the color of the rectangle surrounding the matched area. To see the rectangle, activate the Output marked image showing match location parameter.

Method

For more information on matching methods, see the OpenCV documentation .

SQDIFF: The best matches are low values.

SQDIFF NORMED: The best matches are low values.

TM CCORR: The best matches are high values.

TM CCORR NORMED: The best matches are high values.

TM COEFF: The best matches are high values.

TM COEFF NORMED: The best matches are high values.

Output marked image showing match location: Draws a rectangle around the matching area in the output image.

Thickness: Specifies the rectangle’s border thickness as an integer greater than 0. To see the rectangle, activate the Output marked image showing match location parameter.

Example

This example detects the tortoise’s head in the source image.

TemplateMatchExample