00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2011 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 00034 /*--------------------------------------------------------------- 00035 Namespace 00036 ---------------------------------------------------------------*/ 00037 namespace mrpt 00038 { 00039 namespace math 00040 { 00041 00042 /** @name Fourier functions 00043 @{ */ 00044 00045 /** Computes the FFT of a 2^N-size vector of real numbers, and returns the Re+Im+Magnitude parts. 00046 * \sa fft2_real 00047 */ 00048 void BASE_IMPEXP fft_real( vector_float &in_realData, 00049 vector_float &out_FFT_Re, 00050 vector_float &out_FFT_Im, 00051 vector_float &out_FFT_Mag ); 00052 00053 /** Compute the 2D Discrete Fourier Transform (DFT) of a real matrix, returning the real and imaginary parts separately. 00054 * \param in_data The N_1xN_2 matrix. 00055 * \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). 00056 * \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). 00057 * \sa fft_real, ifft2_read, fft2_complex 00058 * If the dimensions of the matrix are powers of two, the fast fourier transform (FFT) is used instead of the general algorithm. 00059 */ 00060 void BASE_IMPEXP dft2_real( 00061 const CMatrixFloat &in_data, 00062 CMatrixFloat &out_real, 00063 CMatrixFloat &out_imag ); 00064 00065 /** Compute the 2D inverse Discrete Fourier Transform (DFT) 00066 * \param in_real The N_1xN_2 input matrix with real values. 00067 * \param in_imag The N_1xN_2 input matrix with imaginary values. 00068 * \param out_data The N_1xN_2 output matrix (user has not to initialize the size of this matrix). 00069 * Note that the real and imaginary parts of the FFT will NOT be checked to assure that they represent the transformation 00070 * of purely real data. 00071 * If the dimensions of the matrix are powers of two, the fast fourier transform (FFT) is used instead of the general algorithm. 00072 * \sa fft_real, fft2_real 00073 */ 00074 void BASE_IMPEXP idft2_real( 00075 const CMatrixFloat &in_real, 00076 const CMatrixFloat &in_imag, 00077 CMatrixFloat &out_data ); 00078 00079 /** Compute the 2D Discrete Fourier Transform (DFT) of a complex matrix, returning the real and imaginary parts separately. 00080 * \param in_real The N_1xN_2 matrix with the real part. 00081 * \param in_imag The N_1xN_2 matrix with the imaginary part. 00082 * \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). 00083 * \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). 00084 * If the dimensions of the matrix are powers of two, the fast fourier transform (FFT) is used instead of the general algorithm. 00085 * \sa fft_real, idft2_complex,dft2_real 00086 */ 00087 void BASE_IMPEXP dft2_complex( 00088 const CMatrixFloat &in_real, 00089 const CMatrixFloat &in_imag, 00090 CMatrixFloat &out_real, 00091 CMatrixFloat &out_imag); 00092 00093 /** Compute the 2D inverse Discrete Fourier Transform (DFT). 00094 * \param in_real The N_1xN_2 input matrix with real values, where both dimensions MUST BE powers of 2. 00095 * \param in_imag The N_1xN_2 input matrix with imaginary values, where both dimensions MUST BE powers of 2. 00096 * \param out_real The N_1xN_2 output matrix for real part (user has not to initialize the size of this matrix). 00097 * \param out_imag The N_1xN_2 output matrix for imaginary part (user has not to initialize the size of this matrix). 00098 * \sa fft_real, dft2_real,dft2_complex 00099 * If the dimensions of the matrix are powers of two, the fast fourier transform (FFT) is used instead of the general algorithm. 00100 */ 00101 void BASE_IMPEXP idft2_complex( 00102 const CMatrixFloat &in_real, 00103 const CMatrixFloat &in_imag, 00104 CMatrixFloat &out_real, 00105 CMatrixFloat &out_imag ); 00106 00107 00108 /** Correlation of two matrixes using 2D FFT 00109 */ 00110 void BASE_IMPEXP cross_correlation_FFT( 00111 const CMatrixFloat &A, 00112 const CMatrixFloat &B, 00113 CMatrixFloat &out_corr ); 00114 00115 /** @} */ 00116 00117 } // End of MATH namespace 00118 00119 } // End of namespace 00120 00121 #endif
Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:46:17 UTC 2011 |