00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef mrpt_math_fourier_H 00029 #define mrpt_math_fourier_H 00030 00031 #include <mrpt/utils/utils_defs.h> 00032 #include <mrpt/math/CMatrixTemplateNumeric.h> 00033 #include <mrpt/math/CVectorTemplate.h> 00034 00035 /*--------------------------------------------------------------- 00036 Namespace 00037 ---------------------------------------------------------------*/ 00038 namespace mrpt 00039 { 00040 namespace math 00041 { 00042 00043 /** @name Fourier functions 00044 @{ */ 00045 00046 /** Computes the FFT of a 2^N-size vector of real numbers, and returns the Re+Im+Magnitude parts. 00047 * \sa fft2_real 00048 */ 00049 void MRPTDLLIMPEXP fft_real( vector_float &in_realData, 00050 vector_float &out_FFT_Re, 00051 vector_float &out_FFT_Im, 00052 vector_float &out_FFT_Mag ); 00053 00054 /** Compute the 2D Discrete Fourier Transform (DFT) of a real matrix, returning the real and imaginary parts separately. 00055 * \param in_data The N_1xN_2 matrix. 00056 * \param out_real The N_1xN_2 output matrix which will store the real values (user has not to initialize the size of this matrix). 00057 * \param out_imag The N_1xN_2 output matrix which will store the imaginary values (user has not to initialize the size of this matrix). 00058 * \sa fft_real, ifft2_read, fft2_complex 00059 * If the dimensions of the matrix are powers of two, the fast fourier transform (FFT) is used instead of the general algorithm. 00060 */ 00061 void MRPTDLLIMPEXP dft2_real( 00062 const CMatrixFloat &in_data, 00063 CMatrixFloat &out_real, 00064 CMatrixFloat &out_imag ); 00065 00066 /** Compute the 2D inverse Discrete Fourier Transform (DFT) 00067 * \param in_real The N_1xN_2 input matrix with real values. 00068 * \param in_imag The N_1xN_2 input matrix with imaginary values. 00069 * \param out_data The N_1xN_2 output matrix (user has not to initialize the size of this matrix). 00070 * Note that the real and imaginary parts of the FFT will NOT be checked to assure that they represent the transformation 00071 * of purely real data. 00072 * If the dimensions of the matrix are powers of two, the fast fourier transform (FFT) is used instead of the general algorithm. 00073 * \sa fft_real, fft2_real 00074 */ 00075 void MRPTDLLIMPEXP idft2_real( 00076 const CMatrixFloat &in_real, 00077 const CMatrixFloat &in_imag, 00078 CMatrixFloat &out_data ); 00079 00080 /** Compute the 2D Discrete Fourier Transform (DFT) of a complex matrix, returning the real and imaginary parts separately. 00081 * \param in_real The N_1xN_2 matrix with the real part. 00082 * \param in_imag The N_1xN_2 matrix with the imaginary part. 00083 * \param out_real The N_1xN_2 output matrix which will store the real values (user has not to initialize the size of this matrix). 00084 * \param out_imag The N_1xN_2 output matrix which will store the imaginary values (user has not to initialize the size of this matrix). 00085 * If the dimensions of the matrix are powers of two, the fast fourier transform (FFT) is used instead of the general algorithm. 00086 * \sa fft_real, idft2_complex,dft2_real 00087 */ 00088 void MRPTDLLIMPEXP dft2_complex( 00089 const CMatrixFloat &in_real, 00090 const CMatrixFloat &in_imag, 00091 CMatrixFloat &out_real, 00092 CMatrixFloat &out_imag); 00093 00094 /** Compute the 2D inverse Discrete Fourier Transform (DFT). 00095 * \param in_real The N_1xN_2 input matrix with real values, where both dimensions MUST BE powers of 2. 00096 * \param in_imag The N_1xN_2 input matrix with imaginary values, where both dimensions MUST BE powers of 2. 00097 * \param out_real The N_1xN_2 output matrix for real part (user has not to initialize the size of this matrix). 00098 * \param out_imag The N_1xN_2 output matrix for imaginary part (user has not to initialize the size of this matrix). 00099 * \sa fft_real, dft2_real,dft2_complex 00100 * If the dimensions of the matrix are powers of two, the fast fourier transform (FFT) is used instead of the general algorithm. 00101 */ 00102 void MRPTDLLIMPEXP idft2_complex( 00103 const CMatrixFloat &in_real, 00104 const CMatrixFloat &in_imag, 00105 CMatrixFloat &out_real, 00106 CMatrixFloat &out_imag ); 00107 00108 00109 /** Correlation of two matrixes using 2D FFT 00110 */ 00111 void MRPTDLLIMPEXP cross_correlation_FFT( 00112 const CMatrixFloat &A, 00113 const CMatrixFloat &B, 00114 CMatrixFloat &out_corr ); 00115 00116 /** @} */ 00117 00118 } // End of MATH namespace 00119 00120 } // End of namespace 00121 00122 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009 |