Fourier transform of a Rectangle
In special domain, we are given an image as below.
This image is transferred to frequency domain. The transferred image is displayed. Then this image in
frequency domain is transferred back to special domain. Complete this program with MATLAB.
% make the image
f=zeros(30,30);
f(5:24, 13:17)=1;
imshow(f, 'InitialMagnification', 'fit'); % may use imshow(f, [])
% compute and visualize the 30-by-30 DFT of f with these commands
F=fft2(f);
FC=fftshift(F)
% explain fftshift(F)
F2=log(1+abs(FC));
% explain log and abs
imshow (F2, 'InitialMagnification', 'fit'); % may use imshow(F2, [])
%inverse FFT
f1=ifft2(F);
f1=real(f1);
figure, imshow(f1, 'Initial Magnification', 'fit'); % may use imshow(f1, [])