matlab - Fourier transform of image in magnitude not working -


i want plot magnitude , phase of fourier transform of image in matlab. implemented tutorial read in link line line magnitude, white screen plotted.

my code:

i=imread('16.jpg'); ffta = fft2(double(i)); figure, imshow(abs(fftshift(ffta))); title('image fft2 magnitude'); figure, imshow(angle(fftshift(ffta)),[-pi pi]); title('image   fft2 phase') 

my original image : enter image description here

where problem?

two things here.

  1. input image 2d fft should intensity image (or grayscale), mxnx1 in size, not rgb, mxnx3 in size.

  2. if image matrix of class double, intensity expected in [0,1] range. values greater 1 shown 1 (filled highest color of figure colormap).

to convert rgb image grayscale use rgb2gray:

irgb  = imread('16.jpg'); igray = rgb2gray(irgb); 

to solve latter rescale image or use imagesc combined axis equal preserve scale:

figure; imagesc(abs(fftshift(ffta))); axis equal; axis tight; 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -