Add an example application for FFT code usage
We would like to add an example for FFT code usage like. As a reference we could use Gaussian filtering. We need to do these steps:
- Create a directory
examples/fft - Include
src/fft.cpp,src/fft.h,src/filtering.h,src/filtering.cppandsrc/thirdparty/kissfftheader files into the project - Create VS project file (you could copy from
examples/blob_detectionfolder for example - Create make file for the project
- Create CMake file for the project
- Modify
examples/CMakeLists.txtfile to include new project - Modify
examples/makefilefile to include new project
You could refer to any of existing example projects as a reference.
The code for this example project should include file loading, filter usage and file saving.
Hello @ihhub Is this issue still available? If yes, i would be interested to work on it.
Hi @theoniko , surely you can take this issue. Please be free to ask any questions for clarification of the task requirements.
Hello @ihhub Could you be a little more specific about the expected example content? As far as i know the FFT image displays the absolute value (or complex magnitude) of the spatial frequencies found in the image.
We could use FFT to make Gaussian blur:
std::vector<float> filter;
Image_Function::GetGaussianKernel( filter, input.width(), input.height(), 5, 2 );
FFT::ComplexData imageFFT( image );
FFT::ComplexData filterFFT;
filterFFT.resize( input.width(), input.height() );
filterFFT.set( filter );
FFT::FFTExecutor fftExecutor( input.width(), input.height() );
fftExecutor.directTransform( imageFFT );
fftExecutor.directTransform( filterFFT );
fftExecutor.complexMultiplication( imageFFT, filterFFT, imageFFT );
fftExecutor.inverseTransform( imageFFT );
const penguinV::Image output = imageFFT.get();
I think it should work.
@theoniko I've created a pull request to simplify above code from:
FFT::ComplexData filterFFT;
filterFFT.resize( input.width(), input.height() );
filterFFT.set( filter );
into:
FFT::ComplexData filterFFT( filter, input.width(), input.height() );
I will apply those changes at the weekend.