%% dft2demo2 %% show image and log of shifted |DFT| % get image %load mandrill load earth %X = zeros(128,128); X(61:80,41:80)=1; % get and shift 2D FFT of image FX = fft2(X); sFX = fftshift(FX); % display results figure(1) imagesc(X), colormap(gray) title('original image'); figure(2) imagesc(log(1+abs(FX))), colormap(gray) title('log(1+|dft|)'); figure(3) imagesc(log(1+abs(sFX))), colormap(gray) title('shifted log(1+|dft|)');