image = | normalizedCrossCorrelation2dImg (inImg2d,inKnlXY) |
image = | normalizedCrossCorrelation2dImg (inImg2d,inKnlImg2d) |
Computes the Normalized Cross Correlation between an image and a kernel.
The two dimensional Normalized Cross-Correlation (NCC) between an image and a template
is a similarity measure, which is defined in spatial domain as follows :
Where represents the coordinates of a pixel,
is the mean of
in the neighbourhood defined by the kernel and
is the mean of
.
The kernel describes the template to match with the input image. Typically, it represents a region of interest of an altered version of the input image (deformation, noise, ...).
To improve the algorithm peformances, it is recommanded to extract a search area from the initial image to reduce the number of processed data. This area will be given to the algorithm as the input image .
Here is an example of an image, a template to match and the resulting NCC :
As displayed by the colorbar, low values are represented in blue and high values are represented in red. The position of the maximum of the NCC indicates the location of the center of the patch in the image which matches the most with the template.