% Fig. 4.36
% Filtering in frequency domain

clear all;
close all;
f = imread('Fig0429(a)(blown_ic).tif');
imshow(f,'initialmagnification','fit');

F = fft2(f);
[M, N] = size(f);

S = fftshift(log(1 + abs(F)));
imshow(S,[],'initialmagnification','fit');

sigma = 10;
H = lpfilter('gaussian', M, N, sigma);
G = F .* H;
g = real(ifft2(G));
imshow(g, [], 'initialmagnification','fit');

