2D Correlation is typically used to detect similarities between two 2D signals, which are often saved in matrices. The 2D correlation of two matrices, a and b, can be defined as follows:
The 2D Correlation can be linear or circular. For linear correlation, any indexed elements that lie outside the original range are treated as zeros. Correspondingly, for circular correlation, they are viewed as the repetition of elements within the original range. The size of the linear correlation result matrix is as follows:
where m1 and m2 are the widths and heights of the two matrices. Conversely, if computing a circular correlation, the size of the matrix should be M*N, where M and N are the greater of the two matricies width and height, respectively. Conventionally, the linear correlation should be used when the input signal contains impulses, while the circular correlation should be used when the signal can be viewed as periodic.
The magnitude of the correlation shows how similar the signals are. If the correlation is large, the two signals are considered to be very similar. Alternatively, if correlation is zero, the two signals are considered to be independent.
Topics covered in this section: