Analysis: Signal Processing: 2D Correlation
Compute correlation of two matrices
This feature is for OriginPro only.
1. corr2 im1:=Mat(1) im2:=Mat(2);
2. corr2 im1:=Mat(1) im2:=Mat(2) norm:=1;
3. corr2 im1:=Mat(1) im2:=Mat(2) algorithm:=circular;
4. corr2 im1:=Mat(1) im2:=Mat(2) method:=shift;
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Input Matrix | im1 |
Input MatrixObject |
|
Specifies the matrix that has the first input 2D signal. |
Input Matrix | im2 |
Input MatrixObject |
|
Specifies the matrix that has the second input 2D signal. To calculate autocorrelation, use the same matrix as the first input signal (im1). |
Method | method |
Input int |
|
Specifies the method for calculating 2D correlation. Option list
|
Algorithm | algorithm |
Input int |
|
Specifies whether compute linear correlation or circular correlation. Option list
|
Normalize Result | norm |
Input int |
|
Specifies whether or not the result should be normalized. |
Correlation Result | om |
Output MatrixObject |
|
Specifies the output matrix. See the syntax here. |
2D Correlation is usually 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 M and N are the greater width and height of the two matrices respectively. Conversely, if computing a circular correlation, the size of the matrix should be
Conventionally, the linear correlation should be used when the input signals contain impulses, while the circular correlation should be used when the signals 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.
1. To compute the linear correlation of signals in the 1st sheet and the 2nd sheet of a matrix named MBookSignals, use the following script command:
corr2 im1:=[MBookSignals]1!1 im2:= [MBookSignals]2!1
2. To change the method of 2D correlation, open the corr2 dialog and select the option by typing:
corr2 -d
3. To perform a 2D correlation to data using a pre-saved smoothing theme file, save your preferences in the corr2 dialog, and then execute it by typing the following script command, using your own saved-theme title:
corr2 -t "my two-d corelation theme.oth"
For more information, please refer to our User Guide.
Keywords:fourier, fft, linear, circular