FFT2 frequency of each pixel in a 2D Fourier transformed image

48 Ansichten (letzte 30 Tage)
I can not find any documentation describing exactly what the frequencies should be for a 2D Fourier transformed image. FFT should place the DC coefficeint (corrosponding to 0,0 frequency) in the upper left. However, the range of frequencies should go from -N/2 to N/2, where N is the width of the image in pixels. So how does the frequency increase along each axis of the transformed image? If it simply increased by 1/(pixel width) for each consecutive pixel, the range of frequncies would be 0 - N/pixelWidth, which is obviously incorrect.
I can use fftshift(fft(OriginalImage)) to shift the DC component to the center of the image. After doing this, I assume that the u component of frequency is just
number of pixels from the center pixel/pixel width.
But what happens when the width of the original image is an even number of pixels? It seems like the DC component is being placed in the upper left of the fourth quadrant. Quadrants 1,2, and 3 then run from zero to the Nyquist frequency (or -Nfreq to zero), and quadrant 4 only runs from zero to one less than the Nyquist frequency. This does not make any sense to me.
Can someone please clarify what should be happening?
Thanks

Akzeptierte Antwort

Mona Mahboob Kanafi
Mona Mahboob Kanafi am 3 Jun. 2013
Bearbeitet: Mona Mahboob Kanafi am 3 Jun. 2013
Hi,
I can partly answer your question. I also have problem with this DC component for my height image, I removed the mean from my matrix but still I see some peaks around zero frequency in the fft of image.
Anyway, for answering you about assigning frequencies to your image, first just make sure that you are using fft2, because you have an image. Then you need spatial frequencies in both x and y directions which in my case are :
fx=(1/a)*((-n/2:n/2-1)/n); % a is pixelwidth and n number of pixel in x direction
fy=(1/a)*((-m/2:m/2-1)/m); % m number of pixel in y direction
I don't explain how, because Steve in his blog has explained this in detailed:
And just telling you that frequencies are from 0-N as you said, where for each direction (that is, fx or fy), the zero component is at the left corner, but if you use fftshift for the image, you should also use fftshif for the frequencies, which then moves the zero frequencies in the center.
For even number of pixels, for example, n=480 and m=748, then the zero frequency is in (n/2 +1 , m/2 +1) : this is the center point, which in our case is (241,375).
It is also good to take a look at this link to get a view over fft2 center point(end of the link there is a good example of 2D fft:

Weitere Antworten (0)

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by