2.1.22.2.1.14 fft_2d_correlation
Description
Perform 2d correlation on real matrices basing FFT algorithm.
Syntax
int fft_2d_correlation( matrixbase & matSignal1, matrixbase & matSignal2, matrix & matCorrelation, bool bNormalize = true, bool bCircular = true )
Parameters
- matSignal1
- [Input] the real matrices, could be the same one as matSignal2
- matSignal2
- [Input] the real matrices, could be the same one as matSignal1
- matCorrelation
- [Output] the correlation matrix.
- bNormalize
- [Input] normalize corelation result to +/-1 range if true(by default)
- bCircular
- [Input] perform circular correlation if true(by default) or else linear correlation
Return
0 for success or error codes.
Examples
Prior to compilation, load fftEx_utils.c to the workspace by executing the following LabTalk command:
Run.LoadOC("Originlab\fftEx_utils.c", 16);
To retain fftEx_utils.c in the workspace for successive sessions, drag and drop the file from the Temporary folder to the System folder.
EX1
#include <fftex_utils.h>
void fft_2d_correlation_ex1()
{
matrix sig1 = {{1, 0}, {0, 1}};
matrix sig2 = {{0, 1}, {1, 0}};
matrix result(2, 2);
fft_2d_correlation(sig1, sig2, result);
for (int ii=0; ii<2; ii++)
{
for (int jj=0; jj<2; jj++)
printf ("%lf\t", result[ii][jj]);
printf ("\n");
}
}
Remark
See Also
correlation_2d_shift_accumulate
Header to Include
fftEx_utils.h
Reference
|