2014-02-22 49 views
0

我想測試一些傅立葉變換操作,但我不能得到正確的傅里葉變換圖像,例如,請考慮以下圖片:爲什麼我無法使用matlab獲得正確的傅里葉變換圖像?

Lennaenter image description hereWhat is suppose to be

,最後的影像傅里葉變換圖像什麼這應該是我的輸出

我已經使用了MATLAB代碼如下:

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 

我是什麼做錯了?

任何幫助,將不勝感激。

+2

爲什麼不試試imshow(lasft,[]) – michaeltang

回答

2

colormap([0,0,0;1,1,1])作爲二進制顯示器使用colormap(gray)代替。