2.1.24.4.57 shift_2d_correlation_linear


Description

Calculate the linear 2D correlation function using the shift_cumulate method. This is an OriginPro only function.

Syntax

int shift_2d_correlation_linear( int iRows, int iCols, double * mSig1, double * mSig2, double * mCorrelation )

Parameters

iRows
[Input] the number of rows in the input matrices.
iCols
[Input] the number of columns in the input matrices.
mSig1
[Input] the input matrix of size iRows*iCols.
mSig2
[Input] the input matrix of size iRows*iCols.
mCorrelation
[Output] the correlation matrix of size (2*iRows-1)*(2*iCols-1).

Return

0 on success or INVALID_SIZE for invalid matrix size or DATA_SIZE_ERROR for invalid matrices pointers.

(The definition of error codes is according to those in FFT.h)

Examples

EX1

void shift_2d_correlation_linear_ex1()
{
    MatrixLayer ml = Project.ActiveLayer();
    MatrixObject mo = ml.MatrixObjects(0);
    matrixbase& matbase = mo.GetDataObject();
    matrix mat1 = matbase;
    
    matrix mat2;
    mat2 = mat1; 
    int nRows = mat1.GetNumRows();
    int nCols = mat1.GetNumRows();
    
    matrix matDest(2*nRows-1, 2*nCols-1);
    int nRet = shift_2d_correlation_linear(nRows, nCols, mat1, mat2, matDest);
    if (nRet != OE_NOERROR)
    {
        printf("Error occurs when calling ocmath function!\n");
        return
    }
}

Remark

See Also

shift_2d_correlation_circular

Header to Include

origin.h

Reference