%DIP Class Demo
%Shreekanth Mandayam, Rowan University
%
%To show use of the fftshift function for
%shifting frequency origin to center of image

close all;
im=zeros(256);
im(108:148,108:148)=ones(41);
imshow(im);
pause;
figure;
imshow(mat2gray(abs(fft2(im))));
pause;
figure;
imshow(fftshift(mat2gray(abs(fft2(im)))));