scalar = | normalizedCrossCorrelationMsr2d (inImg1,inImg2) |
measures the global Normalized Cross-Correlation between two images
This algorithms computes the global Nocmalized Cross-Correlation (NCC) between the two input images. In opposition to the Normalized Cross-Correlation 2d algorithm which returns an image, the result of this algorithm is a a single scalar value.
The 2D NCC is calculated according to the following formula :
Where is the image domain definition.
The result belongs to , and equals 1 when the images exactly matches, -1 when the images are exactly inverted and 0 when the images are totally different from each other.
The figure below illustrates the NCC behaviour for several cases. First, we show the NCC between an image and its rotation by 45° : the NCC equals approximately 0.226. Then, we calculates the NCC between an image and the ame image with the intensity inversed. The result is approximately -1. Finally, we computes the correlation between two different images. The result is approximately 0.1, i.e. close to 0.
If the input images has several slices along the Z, C or T dimensions, the result is not a scalar but a collection of ipsdk::imaproc::attr::NCCResult. This data structure stores the actual result in its Result field. The other fields can be ignored as long as they are used for the calculation.