## [Vxl-users] 2D shift estimation using cross correlation using vnl_fft_2d

 [Vxl-users] 2D shift estimation using cross correlation using vnl_fft_2d From: Kees van Wijk - 2010-03-24 14:20:14 ```How can I do a cross correlation in Fourier domain using vnl_fft_2d? I do the following, but that seems to only find horizontal shifts?? May there be an issue with things like location of dc (center or corner)? int m_wsx, m_wsy; // size of 2d images double * array_real_1 = new double[ m_wsx*m_wsy ]; // image 1 double * array_real_2 = new double[ m_wsx*m_wsy ]; // image 2 for (int jj=0;jj * m_cplx_array_1 = new vcl_complex[ m_wsx*m_wsy ]; vcl_complex * m_cplx_array_2 = new vcl_complex[ m_wsx*m_wsy ]; const int nSamples = (const int) (m_wsx*m_wsy); for (int ii=0;ii( array_real_1[ii], 0.0 ); // empty imaginary part m_cplx_array_2[ii] = std::complex( array_real_2[ii], 0.0 ); } // forward transforms vnl_matrix> cplx_matrix_1(m_cplx_array_1, m_wsx, m_wsy); m_fft->fwd_transform(cplx_matrix_1); vnl_matrix> cplx_matrix_2(m_cplx_array_2, m_wsx, m_wsy); m_fft->fwd_transform(cplx_matrix_2); // convolution is mu8ltiplication in Fourier domain vnl_matrix> cplx_matrix_3 = cplx_matrix_1.conjugate_transpose() * cplx_matrix_2; // take real part only double * array_real_3 = new double[ m_wsx*m_wsy ]; for (int jj=0;jj

### Thread view

 [Vxl-users] 2D shift estimation using cross correlation using vnl_fft_2d From: Kees van Wijk - 2010-03-24 14:20:14 ```How can I do a cross correlation in Fourier domain using vnl_fft_2d? I do the following, but that seems to only find horizontal shifts?? May there be an issue with things like location of dc (center or corner)? int m_wsx, m_wsy; // size of 2d images double * array_real_1 = new double[ m_wsx*m_wsy ]; // image 1 double * array_real_2 = new double[ m_wsx*m_wsy ]; // image 2 for (int jj=0;jj * m_cplx_array_1 = new vcl_complex[ m_wsx*m_wsy ]; vcl_complex * m_cplx_array_2 = new vcl_complex[ m_wsx*m_wsy ]; const int nSamples = (const int) (m_wsx*m_wsy); for (int ii=0;ii( array_real_1[ii], 0.0 ); // empty imaginary part m_cplx_array_2[ii] = std::complex( array_real_2[ii], 0.0 ); } // forward transforms vnl_matrix> cplx_matrix_1(m_cplx_array_1, m_wsx, m_wsy); m_fft->fwd_transform(cplx_matrix_1); vnl_matrix> cplx_matrix_2(m_cplx_array_2, m_wsx, m_wsy); m_fft->fwd_transform(cplx_matrix_2); // convolution is mu8ltiplication in Fourier domain vnl_matrix> cplx_matrix_3 = cplx_matrix_1.conjugate_transpose() * cplx_matrix_2; // take real part only double * array_real_3 = new double[ m_wsx*m_wsy ]; for (int jj=0;jj

## Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks