%two_cats=imread('two_cats.jpg');
two_cats=imread('result.jpg');
%two_cats=rgb2gray(two_cats);
%two_cats=two_cats(:,:,1); % Grab only the Red component to fake gray scaling
imshow(two_cats)
PQ = paddedsize(size(two_cats));
D0 = 0.09*PQ(1);
H1 = hpfilter('btw', PQ(1), PQ(2), D0, 4); % Calculate the LPF
F=fft2(double(two_cats),size(H1,1),size(H1,2)); % Calculate the discrete Fourier transform of the image
LPF_two_cats=real(ifft2(H1.*F)); % multiply the Fourier spectrum by the LPF and apply the inverse, discrete Fourier transform
LPF_two_cats=LPF_two_cats(1:size(two_cats,1), 1:size(two_cats,2)); % Resize the image to undo padding
figure, imshow(LPF_two_cats, [])
% Display the Fourier Spectrum
Fc=fftshift(F); % move the origin of the transform to the center of the frequency rectangle
S2=log(1+abs(Fc)); % use abs to compute the magnitude (handling imaginary) and use log to brighten display
%S2=abs(Fc);
%figure, imshow(S2,[])