Jump to content

  • Log In with Google      Sign In   
  • Create Account

FFT - Generating the frequency spectrum of the image


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 CaffeinePwrdAl   Members   -  Reputation: 178

Like
0Likes
Like

Posted 26 January 2005 - 05:31 AM

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:
	// 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.

Sponsor:

#2 nmi   Members   -  Reputation: 978

Like
0Likes
Like

Posted 26 January 2005 - 05:38 AM

Maybe you find what you search here:

http://www.student.kuleuven.ac.be/~m0216922/CG/fourier.html

#3 Winograd   Members   -  Reputation: 380

Like
0Likes
Like

Posted 26 January 2005 - 07:46 AM

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.. :)

#4 CaffeinePwrdAl   Members   -  Reputation: 178

Like
0Likes
Like

Posted 26 January 2005 - 10:37 PM

I have the current version (3 somethign or other) installed with visual studio, but i was using the version 2 dev pack for Dev-C++. Ill have a try with the newer one.

And thanks for the link, finally an example! should help me loads!

Thanks





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS