0

I am beginner in Image processing. I want to plot of phase spectrum using MATLAB of any image say Lena or cameraman .

I am adding code what i tried but I don't understand anything about the plot.

how to find locations of frequencies present in an image using phase spectrum ?

image=imread('E:\cameraman.jpg');
figure,imshow(image);
image=rgb2gray(image);
fourier_transform=fftn(image);

phase_spectrum=angle(fourier_transform);
figure,imshow(phase_spectrum)
devraj
  • 171
  • 1
  • 1
  • 6

1 Answers1

0

To get the phase spectrum you just calculate the FFT and get the angle of the resultant array (just as you have done). Usually an fftshift operation is performed after the fft in order to shift the origin of the plot to the centre of the graph i.e

lenaImage = imread('LenaG', 'bmp')
imshow(angle(fftshift(fft2(lenaImage))))

The Lena image and the resultant phase plot can be seen below.

enter image description hereenter image description here

KillaKem
  • 995
  • 1
  • 13
  • 29
  • thank you sir, but it looks that phase spectrum is very complicated .So how to study/analyse the above phase spectrum? – devraj Jun 03 '15 at 02:50
  • The phase of an image is used in the reconstruction of the image.The frequency spectrum just tells you what the frequency elements exist in the image but the phase tells you exactly where those frequencies are in the image.Rotate the lena Image and you will notice that the phase spectrum will also rotate. – KillaKem Jun 03 '15 at 10:39
  • sir, u said," the phase tells you exactly where those frequencies are in the image " . I want to ask you is **how to find locations of frequencies using above phase spectrum ?** – devraj Jun 06 '15 at 13:25
  • Let the amplitude plot above be A[] and the phase plot be B[]. The value of B[a,b] (where a and b are integers) is the phase of the spacial frequency at index A[a,b]. – KillaKem Jun 06 '15 at 15:43
  • sorry sir but I think that things are different in frequency domain. A[a,b] is not spatial frequency . – devraj Jun 06 '15 at 16:44
  • @Killamen also can you give some MATLAB code for finging loacation of any single frequency component? – devraj Jun 06 '15 at 16:47
  • @devraj Can you please look at this post to see what is meant by spacial frequencies please.https://www.cs.auckland.ac.nz/courses/compsci773s1c/lectures/ImageProcessing-html/topic1.htm – KillaKem Jun 06 '15 at 17:17
  • @devraj A[a,b] is the amplitude of the spatial frequency at (a,b) and B[a,b] is it's phase, why do you think this isn't the case? – KillaKem Jun 06 '15 at 17:20