// values is an array of colour values 1 channel 1 byte per pixel
fftw_real inVals[FFTSIZE*FFTSIZE];
fftw_complex outVals[FFTSIZE*FFTSIZE];
for ( int y = 0; y < FFTSIZE; y++ )
{
for ( int x = 0; x < FFTSIZE; x++ )
{
inVals[x + (y * FFTSIZE)] = values[x + (y * FFTSIZE)];
}
}
// tried this, just seems to process a single dimension
// rfftwnd_one_real_to_complex(plan_rc, inVals, (fftw_complex *) inVals);
// FFT the image
rfftwnd_real_to_complex(plan_rc, FFTSIZE*FFTSIZE,
inVals, 1, 0,
(fftw_complex*)outVals, 1, 0);
outVals just seems to contain 0's the only decent numbers I have had has been from using the rfftwnd_one_real_to_complex line. FFTSIZE is the size of the input image (in this case 16 (16x16)).
I think I am doing something wrong. Do i have to use rfftwnd_one_real_to_complex more than once and somehow combine the results? since it seems to process one row of the image only.
FFT - Generating the frequency spectrum of the image
Just wondering if someone could help explain how to generate the frequency spectrum of an image.
I have looked around and seem to not be able to find many code examples.
This is the sort of image I want to achieve:
http://cns-alumni.bu.edu/~slehar/fourier/fourier.html#filtering
and this is what I am doing now:
I noticed that you were using FFTW, but the API has changed much since v2 so I can't really help you. Only thing I can think of is that are you using correct plan? Perhaps you should upgrade your FFTW.. :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement