TemplateMatch

The TemplateMatch block finds the single highest matching area of a template image within a source image.

    TemplateMatch

Library

ComputerVision/Images/Matching

Description

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.

Parameters

TemplateMatch_0

NameLabelDescriptionData TypeValid Values

method

Method

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.

String

'SQDIFF'
'SQDIFF
NORMED'
'TM
CCORR'
'TM
CORR
NORMED'
'TM
COEFF'
'TM
COEFF
NORMED'

externalActivation

External activation

This parameter defines if the block receives or inherits an external activation. When External Activation is used, an additional activation port is added to the block. Default is OFF.

Number

0
1

TemplateMatch_1

NameLabelDescriptionData TypeValid Values

thickness

Thickness

Specifies the rectangle’s border thickness as an integer greater than 0.

Scalar

red

Red

Specifies the rectangle’s color as RGB values.

Scalar

green

Green

Specifies the rectangle’s color as RGB values.

Scalar

blue

Blue

Specifies the rectangle’s color as RGB values.

Scalar

Ports

NameTypeDescriptionIO TypeNumber

src

explicit

input

1

template

explicit

input

2

x

explicit

output

1

y

explicit

output

2

image

explicit

output

3

Port 6

activation

input

externalActivation