**f=imread('4.3.tif');
F=fft2(f);**
當需要對圖像進行填充時候
F=fft2(f,P,Q) %fft2講M x N的圖像填充為P x Q的圖像
傅裡葉頻譜可以使用函數abs來獲得
S=abs(F); %實部和虛部平方和的平方根
%對圖像處理的代碼
f=imread('4.3.tif'); %讀入圖像
F=fft2(f); %傅裡葉變換
S=abs(F); %獲得傅裡葉頻譜
imshow(S,[ ]);
figure(1);
>subplot(121);imshow(f);
subplot(122);imshow(S,[ ]);
Fc=fftshift(F); %将原點移動到頻率矩形中心
S2=log(1+abs(Fc)); %将頻譜動态範圍降低
subplot(141);imshow(f);
subplot(142);imshow(S,[ ]);
subplot(143);imshow(Fc,[ ]);
subplot(144);imshow(S2,[ ]);