Question about fft2 2D Fourier Transform

16 views (last 30 days)
Hello,
I'm sorry for this basic question but i am quite confused with the Fast Fourier Transform function.
I want to find the average frequency of an image (horizontal and vertical average frequency) in order to emphasise the difference between blurred image (low frequency) and "clean" image (with high frequencies). Basically, i want to plot a graph with parameters of a Gaussian filter on x-axis and the average frequency on y-axis.
I used fft2, fftshift... (like basic examples described in Matlab doc) but i feel confused:
gsImgFFT = fft2(currentImg,(X+Y)-1,(X+Y)-1);
gsImgFFTS = fftshift(gsImgFFT);
gsImgFFTSP = abs(gsImgFFTS);
Q1/ i don't understand the unit of the axis: radian per sample ? "cycle per pixel" seems to be more relevant... could you help me to understand the meaning of this unit...
Q2/ I've read the Matlab doc about fft2. fft2=fft(fft(X).').' . ... I understand the graphical result for basic image (a square, a circle, a sine wave ...) but i don't understand the result when the sine wave is oblique. - First it computes a fft of each column which is similar to compute the fft of a sine wave for each column (3 points representing the DC component (f=0), the frequency of the sine wave and the corresponding negative frequency ...). - Then it compute the fft of each row of the matrix obtain at the previous step ... how is it possible to obtain points aligned in the oblique direction ... i don't understand this result ... for me the result is a kind of lattice. :(
Q3/ Concerning the computation of average horizontal or vertical frequency (I am not sure but i try do sum each column value and then find the average frequency with a weighted average method ...), am i wrong if i just use the sub-matrix [m/2:m and n/2:n] of my mxn initial FFT2 Matrix (because i use fftShift) ? And finally how can i translate this average value (which has been shifted) in order to find the real average frequencies?
HRange = 1:size(subMatrix,2);
VRange = 1:size(subMatrix,1);
%average horizontal frequency
HF = sum(subMatrix,1)/size(subMatrix,1);
HF = sum(HF.* HRange) / (sum(HF)+1);
%average vertical frequency
VF = sum(subMatrix,2)/size(subMatrix,2);
VF = sum(VF .* VRange') / (sum(VF)+1);
Thank you for your help (i hope everything is clear ...), any help will be appreciate !!!
Optional Question: Do you know good books about Fourier transform for n Dim Data (2D image ...) and books about the use of Matlab for image treatment.
  1 Comment
Deepanshu
Deepanshu on 11 Mar 2011
Chatan can you please post the solution of your question so as i learn it.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 11 Mar 2011
"Q1/ i don't understand the unit of the axis: radian per sample ? "cycle per pixel" seems to be more relevant... could you help me to understand the meaning of this unit..."
Recall that fft2() can be applied to any kind of data, not just to images. For example it can be applied to 2D MRS (Magnetic Resonance Spectroscopy) data, which does not have "pixels". "samples" is more general than "pixels". In your case your samples are pixels, but not so for other people who might be using fft2()
  1 Comment
chaton
chaton on 11 Mar 2011
thank you i understand (i am stupid) !!! thank you for Q1 :)

Sign in to comment.

More Answers (1)

chaton
chaton on 14 Mar 2011
Hello Deepanshu (thank you again Walter). I need more answers for question 2 and 3 but i will post my Matlab code as soon as possible. Any help on Q2 and 3 will be appreciate.
Thank you.

Tags

Community Treasure Hunt

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

Start Hunting!