FFT of an image

조회 수: 237 (최근 30일)
Rachel
Rachel 2012년 6월 18일
Hello,
I am a new Matlab user trying to compute the FFT of a set of images using the following code:
I=imread('imagename.pbm');
F=fft2(double(I));
S=fftshift(F);
L-log2(S);
A=abs(L);
imagesc(A)
The code works fine and produces a 2D power spectrum of my image and during subsequent processing I histogram the data in A according to distance form the centre. I have two questions:
  1. How do I read this output? The majority of the data cluster around one point on the x-axis...is the corresponding value on the x-axis in cycles/deg? If not how do I get this information from the analysis?
  2. How do I read in multiple images at a time so that I don't have to do this analysis for each individual image?
Thank you so much for your help!!
Rachel
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 6월 18일
Note: you will probably want
S = fftshift( fftshift(F), 2 );
as otherwise you only move the origin to the center of an edge rather than to the center of the array.
Dr. Seis
Dr. Seis 2012년 6월 18일
doing "fftshift" twice is not necessary:
>> a = rand(4,4)
a =
0.4669 0.3845 0.6051 0.5502
0.0665 0.6463 0.9255 0.3866
0.3338 0.2953 0.9869 0.0707
0.7681 0.4264 0.7705 0.7959
>> fftshift(a)
ans =
0.9869 0.0707 0.3338 0.2953
0.7705 0.7959 0.7681 0.4264
0.6051 0.5502 0.4669 0.3845
0.9255 0.3866 0.0665 0.6463

댓글을 달려면 로그인하십시오.

채택된 답변

Dr. Seis
Dr. Seis 2012년 6월 18일
See my answer here for a coded up description of what the 2D Fourier transform does using a random 2D image as an example (should help with your first question):
As to your second question, why wouldn't you do the analysis on an image by image basis? Or is it you want to read in multiple images at one time and then perform some operation on each of them in a similar way?

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by