0
$\begingroup$

I have read that from Fourier transform we obtain magnitude and phase spectrum. The magnitude spectrum tells you how strong are the harmonics in a image and the phase spectrum tells where this harmonic lies in space.

I have used Matlab to compute the magnitude and phase spectrum of the 2 grayscale images of babies using fftn function, but the all spectrum are difficult to understand.

enter image description here

enter image description here

Can anyone please explain the features given in 1st paragraph by comparing the spectrums of both babies ?

1.phase spectrum

and

2.magnitude spectrum

(If you have results other than in Matlab, explaining with your method is also okay)

image1=imread('D:\baby1.jpg');%Read colour image
image1=rgb2gray(image1);%covert colour image into Gray scale

image2=imread('D:\baby2.jpg');%Read colour image
image2=rgb2gray(image2);%covert colour image into Gray scale

figure,
subplot(1,3,1);
imshow(image1);
title('Gray scale Image of Baby1');

%Apply Fourier transform on Gray scale image
fft1=fftn(image1);
fft1=log(1+fftshift(fft1));%Use log function for scaling

%Find the magnitude spectrum
magnitude1=abs(fft1);
subplot(1,3,2);
imshow(magnitude1,[]);
title('Amplitude Spectrum 1');

%Find the phase spectrum
phase1=angle(fft1);
subplot(1,3,3);
imshow(phase1,[]);
title('Phase Spectrum 1');



figure,
subplot(1,3,1);
imshow(image2);
title('Gray scale Image of Baby2');

%Apply Fourier transform on Gray scale image
fft2=fftn(image2);
fft2=log(1+fftshift(fft2));%Use log function for scaling

%Find the magnitude spectrum
magnitude2=abs(fft2);
subplot(1,3,2);
imshow(magnitude2,[]);
title('Amplitude Spectrum 2');

%Find the phase spectrum
phase2=angle(fft2);
subplot(1,3,3);
imshow(phase2,[]);
title('Phase Spectrum 2');
$\endgroup$
5
  • 2
    $\begingroup$ What kind of "understanding" are you assuming is possible beyond the mathematical formulas? For a limited sort of "understanding", you might try using some extremely simple images, e.g. just a few vertical stripes, horizontal stripes, a few checks of a checkerboard rotated at various angles, etc. A 2D FFT is a linear transform, so composite as needed. $\endgroup$
    – hotpaw2
    Commented May 11, 2015 at 19:32
  • 1
    $\begingroup$ Did you try to write your own code and did you try to carry out your own experiments with simple images. The code and images from your question taken from other question - link, link. $\endgroup$
    – SergV
    Commented May 12, 2015 at 5:08
  • $\begingroup$ @SergV sorry sir,i will write my code and post it's result after some time. $\endgroup$
    – pandu
    Commented May 12, 2015 at 5:44
  • $\begingroup$ @SergV sir,i have made changes $\endgroup$
    – pandu
    Commented May 12, 2015 at 8:17
  • $\begingroup$ To all the "duplicators", you should be careful in stating such claims. The idea is to learn more and not limit our understanding to the limitations of the questions and readers. Suggest to remove the duplication SINCE IT IS NOT! $\endgroup$
    – Moti
    Commented May 13, 2015 at 17:14

1 Answer 1

0
$\begingroup$

When you create the transform, an embedded assumption is that you extend your image to infinity by duplicating it vertical and horizontal direction. Each point in the transform provides information about a 1D wave (frequency that has certain direction based on the point location and phase (how it is moved along the image). Try to draw a 1D sine wave over a 2D array and then run the 2D FFT to see how the point is created - the higher the frequency the point further from the origin. Starting at a peak will result a $90^0$ phase...

$\endgroup$
4
  • $\begingroup$ sir could you change your answer with my edited question? $\endgroup$
    – pandu
    Commented May 12, 2015 at 10:21
  • $\begingroup$ It is good that you used a specific example. It does not seem that you can really use effectively the frequency domain to learn to much about the images. What you may notice is that the key content of images is centered in the low frequencies. $\endgroup$
    – Moti
    Commented May 13, 2015 at 15:39
  • $\begingroup$ but others have marked my question as duplicated $\endgroup$
    – pandu
    Commented May 13, 2015 at 17:03
  • $\begingroup$ Well, you expanded by mentioning the phase. The quality of the answers here is some times not too great. Phase is an extremely important measure to determine, as example, motion in the image and particularly motion of the camera. The majority of responders has minimal depth and as result may claim duplication because they do not see the importance of certain pieces of information. I do not think that your question is an exact duplication and the answer to it is different! A you may see from the -1. $\endgroup$
    – Moti
    Commented May 13, 2015 at 17:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.