LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiRealInvFFT.h

00001 /*
00002  * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00024 /*----------------------------------------------------------------
00025  * project ....: LTI Digital Image/Signal Processing Library
00026  * file .......: ltiRealInvFFT.h
00027  * authors ....: Stefan Syberichs, Pablo Alvarado
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 06.12.99
00030  * revisions ..: $Id: ltiRealInvFFT.h,v 1.3 2006/02/08 11:44:08 ltilib Exp $
00031  */
00032 
00033 
00034 #ifndef _LTI_REAL_INV_FFT_H_
00035 #define _LTI_REAL_INV_FFT_H_
00036 
00037 #include "ltiFunctor.h"
00038 #include "ltiImage.h"
00039 #include "ltiMath.h"
00040 #include "ltiTransform.h"
00041 #include "ltiRealFFT.h"
00042 
00043 namespace lti {
00044 
00045   /**
00046    * A class for inverse FFT.
00047    * realFFT is a class for Fast Fourier Transforms on lti::vectors
00048    * and lti::matrix<float>.  The input can either be in polar or cartesic
00049    * format, specified by the parameter inputMode. The FFT on matrix<float>
00050    * works full-sized input matrices (i.e the size of the output
00051    * data), while the vector FFT works only one half (!) of the
00052    * Fourier coefficients per dimension (real and imaginary). Note
00053    * that cartesic input data computes faster!  The apply-methods are
00054    * based on fast inverse FFT-routines written by Takuya Ooura (the original
00055    * code can be found
00056    * <a href="http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html">here</a>)
00057    * that have been adapted for the use on lti::vectors and matrix<float>.
00058    * Note that the cartesic output is faster !
00059    * Usage:
00060    *
00061    *  \code
00062    *  #include "ltiRealInvFFT.h"
00063    *  #include "ltiRealFFT.h"
00064    *
00065    *  lti::realFFT fft2d;       // for 2-dimensional FFT
00066    *  lti::realInvFFT ifft2d;   // for 2-dimensional inverse FFT
00067    *
00068    *  lti::realFFT::parameters par2d;
00069    *
00070    *  par2d.mode = lti::realFFT::parameters::Polar;
00071    *
00072    *  ifft2d.setParameters(par2d);
00073    *  fft2d.setParameters(par2d);
00074    *
00075    *
00076    *  fft2d.apply(R, re, im);       // the actual FFT
00077    *
00078    *  ifft2d.apply(re, im, back);   // inverse FFT
00079    *  \endcode
00080    */
00081   class realInvFFT : public transform {
00082   public:
00083 
00084     /**
00085      * Parameter class of the realInvFFT class (are compatible with the
00086      * parameters of the realFFT functor).
00087      */
00088     typedef realFFT::parameters parameters;
00089 
00090     /**
00091      * constructor
00092      */
00093     realInvFFT(void);
00094 
00095     /**
00096      * detsructor
00097      */
00098     ~realInvFFT(void);
00099 
00100     /**
00101      * returns current parameters.
00102      */
00103     const parameters& getParameters() const;
00104 
00105     /**
00106      * returns the name of this type
00107      */
00108     virtual const char* getTypeName() const;
00109 
00110     /**
00111      * returns a pointer to a clone of the functor.
00112      */
00113     virtual functor* clone() const;
00114 
00115     /**
00116      * on-copy method vor vectors. The input data has the half the size of
00117      * the output data (i.e. only the positive coefficients are used).
00118      * @param realInput the real part of the Fourier coefficients
00119      *                  (Polar or Cartesic), size (n/2)+1
00120      * @param imagInput the imaginary part of the Fourier coefficients
00121      *                  (Polar or Cartesic), size (n/2)+1
00122      * @param realOutput the real inverse-computed signal, size n
00123      */
00124     void apply(const vector<float>& realInput,
00125                const vector<float>& imagInput,
00126                      vector<float>& realOutput) const;
00127 
00128     /**
00129      * on-copy method vor vectors. The input data has the half the size of
00130      * the output data (i.e. only the positive coefficients are used).
00131      * @param realInput the real part of the Fourier coefficients
00132      *                  (Polar or Cartesic), size (n/2)+1
00133      * @param imagInput the imaginary part of the Fourier coefficients
00134      *                  (Polar or Cartesic), size (n/2)+1
00135      * @param realOutput the real inverse-computed signal, size n
00136      */
00137     void apply(const vector<double>& realInput,
00138                const vector<double>& imagInput,
00139                      vector<double>& realOutput) const;
00140 
00141     /**
00142      * on-copy method for matrix<float>. The input data has the half the
00143      * size of the output data (i.e. only the positive coefficients are used).
00144      * Note that the  DC component of the signal is in the upper-left corner
00145      * of the two-dimensional FFT. (corresponds to the FFT output)
00146      * @param realInput the real part of the Fourier coefficients
00147      *                  (Polar or Cartesic), size n
00148      * @param imagInput the imaginary part of the Fourier coefficients
00149      *                  (Polar or Cartesic), size n
00150      * @param realOutput the real inverse-computed signal, size n
00151      */
00152     void apply(const matrix<float>& realInput,
00153          const matrix<float>& imagInput,
00154                      matrix<float>& realOutput) const;
00155 
00156   };
00157 
00158 } // namespace lti
00159 #endif

Generated on Sat Apr 10 15:26:03 2010 for LTI-Lib by Doxygen 1.6.1