2.1.22.2.1.2 correlation_2d_shift_accumulate
Description
Perform 2d correlation on real matrices basing shift-matrix-accumulated algorithm.
Syntax
int correlation_2d_shift_accumulate( matrixbase & matSignal1, matrixbase & matSignal2, matrixbase & matCorrelation, bool bNormalize = true, bool bCircular = true )
Parameters
- matSignal1
- [Input] the real matrices
- matSignal2
- [Input] the real matrices, could be the same one as above one
- 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 correlation_2d_shift_accumulate_ex1()
{
matrix sig1 = {{1, 0}, {0, 1}};
matrix sig2 = {{0, 1}, {1, 0}};
matrix result(2, 2);
correlation_2d_shift_accumulate(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
Prior to running this function, the fftEx_utils.c file need to be loaded and compiled. This can be done from Labtalk script with the following command:
run.LoadOC(Originlab\fftEx_utils.c);
See Also
fft_2d_correlation
Header to Include
fftEx_utils.h
Reference
|