From: Do on
Hi. I am a beginner in image processing and matlab. Can anybody let me know the matlab code to get the fourier spectrum of an image?
All I can do is up to here.

im= imread('1.jpg');
f = rgb2gray(im);
F = fft2(f);

What is next?
Thank a lot.
From: Luca Balbi on
You're pretty much done.

F is now your Fourier Transform, maybe you can try visualising the magnitude, if that is what you mean by spectrum:

figure;
pcolor(abs(F));
axis ij;

even better, I would try a log scale:

figure;
pcolor(log(1+abs(F)));
axis ij;
From: ImageAnalyst on
You might want to look into fftshift() so that the origin is at the
center of the spectrum image. It's more intuitive that way.
From: Eric Griffin on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <01c671a5-0f5d-4787-a008-5cee0512f0d9(a)o14g2000yqb.googlegroups.com>...
> You might want to look into fftshift() so that the origin is at the
> center of the spectrum image. It's more intuitive that way.

I am looking at doing the same thing. I have computed the fft and have shifted it... but when I find the spectrum, i just get a black screen. Any thoughts?
From: ImageAnalyst on
On May 10, 10:26 pm, "Eric Griffin" <e.griffin.1...(a)gmail.com> wrote:
> ImageAnalyst <imageanal...(a)mailinator.com> wrote in message <01c671a5-0f5d-4787-a008-5cee0512f...(a)o14g2000yqb.googlegroups.com>...
> > You might want to look into fftshift() so that the origin is at the
> > center of the spectrum image.  It's more intuitive that way.
>
> I am looking at doing the same thing.  I have computed the fft and have shifted it... but when I find the spectrum, i just get a black screen.  Any thoughts?

------------------------------------------------------------
How are you displaying it? Did you try something like
imshow(realArray, []);

The [] is important when displaying floating point images.