?? 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 + -