00001 #ifndef vnl_fft_2d_h_ 00002 #define vnl_fft_2d_h_ 00003 /* 00004 fsm@robots.ox.ac.uk 00005 */ 00006 00007 //: In-place 2D fast fourier transform. 00008 00009 #include <vnl/vnl_matrix.h> 00010 #include <vnl/algo/vnl_fft_base.h> 00011 00012 template <class T> 00013 struct vnl_fft_2d : vnl_fft_base<2, T> 00014 { 00015 typedef vnl_fft_base<2, T> base; 00016 00017 //: constructor takes size of signal. 00018 vnl_fft_2d(int M, int N) { 00019 base::factors_[0].resize(M); 00020 base::factors_[1].resize(N); 00021 } 00022 00023 //: dir = +1/-1 according to direction of transform. 00024 void transform(vnl_matrix<vcl_complex<T> > &signal, int dir) 00025 { base::transform(signal.data_block(), dir); } 00026 00027 //: forward FFT 00028 void fwd_transform(vnl_matrix<vcl_complex<T> > &signal) 00029 { transform(signal, +1); } 00030 00031 //: backward (inverse) FFT 00032 void bwd_transform(vnl_matrix<vcl_complex<T> > &signal) 00033 { transform(signal, -1); } 00034 00035 //: return size of signal. 00036 unsigned rows() const { return base::factors_[0].number(); } 00037 unsigned cols() const { return base::factors_[1].number(); } 00038 }; 00039 00040 #endif