Reputation: 3341
I am trying a test some Fourier transformation operations, but i cannot get correct Fourier transformed image, for example, consider following images:
The last image is the Fourier transformed image what which should be my output
The matlab code i have used is as following:
function fftshow(file)
close all;
img=imread(file);
ft=fft2(img(:,:,1));
sft=fftshift(ft);
asft = abs(sft);
lasft = log2(asft+1);
imagesc(img), title('The real image');
pause
imagesc(asft), colormap([0,0,0;1,1,1]), title('The magnitude image');
pause
imagesc(lasft), colormap([0,0,0;1,1,1]), title('The log2 magnitude image');
clear img ft sft;
end
what am i doing wrong?
Any help would be appreciated.
Upvotes: 0
Views: 240
Reputation: 12699
colormap([0,0,0;1,1,1])
works as a binary display, use colormap(gray)
instead.
Upvotes: 2