f=imread('gedung.bmp');
f=rgb2gray(f);
figure
subplot(2,2,1),imshow(f);
PQ=paddedsize(size(f));
D0=0.05*PQ(1);
H=hpfilter('gaussian',PQ(1),PQ(2),D0);
F=fft2(double(f),size(H,1),size(H,2));
HPF_f=real(ifft2(H.*F));
HPF_f=HPF_f(1:size(f,1),1:size(f,2));
subplot(2,2,2),imshow(HPF_f,[]);
subplot(2,2,3),imshow(abs(HPF_f)>0.2*abs(max(HPF_f(:))));
Fc=fftshift(F);
S2=log(1+abs(Fc));
subplot(2,2,4),imshow(S2,[]);