简体   繁体   中英

Why i cannot getting correct Fourier transformed image using matlab?

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.

colormap([0,0,0;1,1,1])用作二进制显示,使用colormap(gray)代替。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM