# 18.14 2D Correlation (Pro Only)

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:

$r(i,j)=\sum_{m=1}^M \sum_{n=1}^N a(m,n)b(m-i.n-j)$

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: (m1+m2-1)*(n1+n2-1) 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.

##### To Use 2D Correlation Tool
1. Make a matrix book active.
2. Select Analysis: Signal Processing: 2D Correlation from the Origin menu.
 Topics covered in this section: