MF_xcorr
| MD_xcorr |
ME_xcorr |
MFb_xcorr
| MDb_xcorr |
MEb_xcorr |
|
Function | spatial cross-correlation function |
|
Syntax C/C++ | #include <MFstd.h>
void MF_xcorr( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len );
void MFb_xcorr( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len, fVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::xcorr( const matrix<T>& MA, const matrix<T>& MB );
void matrix<T>::b_xcorr( const matrix<T>& MA, const matrix<T>& MB, vector<T>& Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_xcorr( MC, MA, MB:fMatrix; ht, len:UIntSize );
procedure MFb_xcorr( MC, MA, MB:fMatrix; ht, len:UIntSize; Buf:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_xcorr( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len );
void MFcu_xcorr( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_xcorr( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_xcorr( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize );
|
|
Description | The spatial cross-correlation function (SCCF) of MA and MB is calculated and stored in MC in wrap-around order in both dimensions: The row elements MCi,0 to MCi,len/2-1 contain the SCCF for zero and positive x lags. Beginning with the most negative lag in MCi,len/2+1, the elements up to MCi,len-1 contain the SCCF for negative lags. Since this function assumes MA and MB to be periodic, the SCCF for the most positive lag is identical to the SCCF for the most negative lag. This element is stored as MCi,len/2.
Similarly, the column elements MC0,j to MClen/2-1,j contain the SCCF for zero and positive y lags. Beginning with the most negative lag in MClen/2+1,j, the elements up to MClen-1,j contain the SCCF for negative lags.
To get the SCCF into normal order, you may call
MF_Rows_rotate( MC, ht, len, len/2 );
MF_Cols_rotate( MC, ht, len, ht/2 );
After that, the zero point is at the position MCht/2,len/2.
In case MA or MB are non-periodic, you should avoid end effects by the methods described in connection with MF_convolve.
All three matrices involved have the same dimensions. Both ht and len must be integer powers of 2.
Internally, MF_xcorr allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_xcorr instead. For C/C++, the size of Buf must be >= 2*ht*(len+2), for Pascal/Delphi, it must be >= 2*ht*len.Additionally, Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf. |
|
Error handling | If either len or ht is not a power of 2, VF_FFT (on which MF_xcorr is based) complains "Size must be an integer power of 2" and the program is aborted. |
|
|