Theory

Template matching based on normalized-cross-correlation (NCC) algorithm uses the minimization of squared Euclidean distance at position

Equation 53.


to find best matching between a reference object (with dimension ) and a region in an image at position . The Euclidean distance is minimized, when the linear cross correlation coefficient

Equation 54.


between the reference object and image region is maximized. To account for intensity variations in the image and make the correlation coefficient invariant to pixel intensities, the correlation between the difference of object to the mean value and image region to the mean value is calculated. According to [Bur06] the so called normalized-cross correlation coefficient can then be expressed as:

Equation 55.


with

Equation 56.


The result of is between -1 and 1. The higher the accordance between reference image and image region is, the higher is result of . The position in image with highest value of , is the location where the reference object is found.