For more information on the FFTW library, see http://theory.lcs.mit.edu/~fftw/.
Since DEC machines do not have a nano-second clock, computing the best way to perform a FFT takes an awful lot of time on DEC machines. Consequently, a kludge was made -- that computation is done only for the first fftsize passed in and the same plan is used for all subsequent calls. Therefore, the FFTObjs in an application all have to use the same fftsize. This is no problem for most image-processing applications.
If there is a need for applications on Sun to use FFTs of different sizes, the kludge can be removed. A possible change, for DEC users who find that they need FFTs of different sizes, is use FFTW_ESTIMATE instead of FFTW_MEASURE. See the documentation of the FFTW library for details.
Public Member Functions | |
FFTObj (Data2D< int >, int req_fftsize) | |
Constructs the FFT for the passed in data. | |
FFTObj (Data2D< double >, int req_fftsize) | |
Constructs the FFT for the passed in data. | |
FFTObj (const FFTObj &orig) | |
This is a deep-copy constructor. | |
~FFTObj () | |
Frees resources allocated to FFTObj. | |
Data2D< double > | getRealPart () const |
To get the real part of the FFT. | |
Data2D< double > | mapRealPart () const |
The real part of the image is in "transform" space. | |
Data2D< double > | getImagPart () const |
To get the imaginary part of the FFT. | |
void | convolve (const FFTObj *filterFFTObj) |
Filtering, or convolution, of two FFTObj's may be performed using the convolve member function. | |
void | ifft () |
Performs an Inverse FFT on an FFTObj. | |
void | unscale (int additionalFactor=1) |
Unscales FFT. | |
int | getSize () const |
Returns current fftsize. | |
Static Public Member Functions | |
static int | calcOptimumSize (int lowestSize) |
returns a number greater than lowest size that will give you speedy FFTs. |
FFTObj::FFTObj | ( | Data2D< int > | , | |
int | req_fftsize | |||
) |
Constructs the FFT for the passed in data.
The constructor requires a 2D data object and the fftsize to be specified. The FFT is faster for certain values of fft_size; use the function calcOptimumSize() to choose a fft size given your image's dimensions.
FFTObj::FFTObj | ( | Data2D< double > | , | |
int | req_fftsize | |||
) |
Constructs the FFT for the passed in data.
The constructor requires a 2D data object and the fftsize to be specified. The FFT is faster for certain values of fft_size; use the function calcOptimumSize() to choose a fft size given your image's dimensions.
FFTObj::FFTObj | ( | const FFTObj & | orig | ) |
This is a deep-copy constructor.
Pass FFTObj around either by pointer or by reference.
FFTObj::~FFTObj | ( | ) |
Frees resources allocated to FFTObj.
static int FFTObj::calcOptimumSize | ( | int | lowestSize | ) | [static] |
returns a number greater than lowest size that will give you speedy FFTs.
The FFT is most efficient for a fftsize that is a multiple of small prime numbers. The static function provides the best size for a given image:
int req_fftsize = FFTObj :: calcOptimumSize( myImage.dim_x() ); This size need not be used; you could use the actual dimension of the image if that is what you need. Be aware that using a particularly bad value for the fftsize could result in severe performance degradation. It is highly recommended that you use this function.
void FFTObj::convolve | ( | const FFTObj * | filterFFTObj | ) |
Filtering, or convolution, of two FFTObj's may be performed using the convolve member function.
The "this" object is changed.
FFTObj fft_kernel( kernelImage, req_fftsize ); fft_image.convolve( &fft_kernel ); // fft_kernel is not changed.
This will convolve the fft_image using the fft_kernel and store the result in fft_image. The fft_kernel itself is not changed. The two FFTObj's should, of course, have the same size.
Data2D<double> FFTObj::getImagPart | ( | ) | const |
To get the imaginary part of the FFT.
Data2D<double> FFTObj::getRealPart | ( | ) | const |
To get the real part of the FFT.
int FFTObj::getSize | ( | ) | const [inline] |
Returns current fftsize.
void FFTObj::ifft | ( | ) |
Performs an Inverse FFT on an FFTObj.
Example:
fft_image.ifft(); fft_image.unscale(); The unscale step is necessary since the FFTs are scaled. At the time of the unscale step, any additional factors can be passed in. For example,
fft_image.unscale( 1000 ); will reduce the intensity of the resulting objects by a factor of 1000.
Data2D<double> FFTObj::mapRealPart | ( | ) | const |
The real part of the image is in "transform" space.
To have the pixels where you expect to see them, use:
Data2D<double> realPart = fft_image.mapRealPart();
void FFTObj::unscale | ( | int | additionalFactor = 1 |
) |
Unscales FFT.
See ifft.