📄 showfft.m
字号:
% function showfft(input_image,)
% show the 2d fft transform of an gray scale image
% input: input_image -- input image, should be gray scale image
% with_phase -- =1 show phase and fft magnitude (shifted)
% =0 show magnitude (shifted) only
function showfft(img,with_phase)
colormap(gray(256));
if with_phase==1,
% with phase
% img = double(img);
fft_img = fft2(img);
subplot(221); imshow(img,[]); title('Image');
pause;
subplot(222); imshow(log10(abs(fft_img)),[]); title('FFT log Magnitude (not shifted)');
subplot(223); imshow(fftshift(log10(abs(fft_img))),[]); title('FFT log Magnitude (shifted)');
subplot(224); imshow(fftshift((angle(fft_img)+3.14)/6.28),[]); title('FFT Phase (shifted)');
h = gcf;
truesize(h,[256*4 256*4]);
pause;
clf;
else
% without phase
fft_img = fft2(img);
subplot(121); imshow(img,'truesize'); title('Image');
subplot(122); imagesc(fftshift(log10(abs(fft_img)))); title('FFT log Magnitude (shifted)');
pause;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -