%% dft2demo1
% show image, |DFT|, and log(1+|DFT|)

% S. Allen Broughton

%% get image
load clown
% uncomment next line to eliminate DC coefficient
% X= X-mean(X(:)); % eliminate DC coefficient
 
% get 2D FFT of image
FX = fft2(X); 

%% display results 
figure(1)
subplot(2,2,1);
imagesc(X), colormap(gray)
title('original image');
subplot(2,2,2)
imagesc(abs(FX)); colormap(gray)
title('|dft|'); 
subplot(2,2,3)
imagesc(abs(FX(1:8,1:8))); colormap(gray) 
title('corner of |dft|');
subplot(2,2,4)
imagesc(log(1+abs(FX))); colormap(gray)
title('log(1+|dft|)');