Correlation: template matching
Building the Cantata Workspace
- Convert the input image $DIP/data/gull.viff to floating point
using the operator
Convert Type.
- Select a small (10x10) pattern from the image using the
Extract operator.
- Perform the correlation between the image and the pattern using the
Linear Operator. See
Statistics
operator to find the coordinates of the maximum point of the result
- Perform the normalized correlation:
- Take the square of the gull image using the
Square operator.
- Create a constant kernel with
same size as the pattern (10x10) using the
Constant
operator and perform correlation between the squared image and this
kernel.
- Take the square root of the result using the
Square Root
operator.
-
Divide
the normal correlation by the normalization factor just created.
- Find the maximum of the normalized correlation using the
Statistics operator.
Exercises
- Perform the same experiment but in the frequency domain.
DIP Feedback Form