%% dft2demo2 %% show image and log of shifted |DFT| % get image load chess % get 2D FFT of image X= X-mean(mean(X)); % get rid of the DC component X = zeros(126); X(21:40,21:40)=1; FX = fft2(X); sFX = fftshift(FX); % display results figure(1) showgimg(X,128) title('original image'); figure(2) [m,n]=size(X); % showgimg((1+abs(sFX)),128,[],[-n/2,n/2],[-m/2,m/2]) showgimg(log(.01+abs(sFX)),128,[],[-n/2,n/2],[-m/2,m/2]) %title('log(1+|dft|)'); title('shifted log(1+|dft|)');