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 : 
where problem?
two things here.
input image 2d fft should intensity image (or grayscale), mxnx1 in size, not rgb, mxnx3 in size.
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
Post a Comment