00001 /*! @file Image/FFTWWrapper.H -- find the Fourier Transform of an image */ 00002 00003 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Image/FFTWWrapper.H $ 00004 // $Id: FFTWWrapper.H 9993 2008-07-29 00:04:18Z lior $ 00005 00006 #ifndef HAHAH_H 00007 #define HAHAH_H 00008 00009 //compile with g++ FFTWWrapper.cpp -L ~/fftwinstall/lib/ -I ~/fftwinstall/include/ -l fftw3 -o FFTWWrapper -lm 00010 #include <stdlib.h> 00011 #include <math.h> 00012 #include <float.h> 00013 00014 #ifdef HAVE_FFTW3_H 00015 #include <fftw3.h> 00016 #endif 00017 00018 class FFTWWrapper 00019 { 00020 00021 public: 00022 FFTWWrapper(int width, int height); 00023 void init(double *image); 00024 ~FFTWWrapper(); 00025 void compute(double **magspec); 00026 //! arraydata implementation 00027 void compute(double *magspec); 00028 private: 00029 #ifdef HAVE_FFTW3_H 00030 inline double mag(fftw_complex c) 00031 { 00032 return (sqrt(c[0]*c[0] + c[1]*c[1])); 00033 } 00034 00035 double *in; 00036 int imageheight; 00037 int imagewidth; 00038 fftw_complex *out; 00039 fftw_plan p; 00040 #endif // HAVE_FFTW3_H 00041 }; 00042 00043 #endif