im = imread('d:\comp vision\images\travis.jpg');
im = rgb2gray(im);

lowpassffthigh   = lowpassfilter(size(im), 0.05, 50);
highpassffthigh  = highpassfilter(size(im), 0.05, 50);
highboostfft     = highboostfilter(size(im), 0.05, 50, 0.5);
lowpassfftlow    = lowpassfilter(size(im), 0.05, 1);
highpassfftlow   = highpassfilter(size(im), 0.05, 1);

imfft = fft2(im);

surfl(fftshift(lowpassffthigh)), shading interp;
print -dpng lowpassffthighfreq.png
surfl(fftshift(highpassffthigh)), shading interp;
print -dpng highpassffthighfreq.png
surfl(fftshift(highboostfft)), shading interp;
print -dpng highboostfftfreq.png
surfl(fftshift(lowpassfftlow)), shading interp;
print -dpng lowpassfftlowfreq.png
surfl(fftshift(highpassfftlow)), shading interp;
print -dpng highpassfftlowfreq.png

surfl(fftshift(real(ifft2(lowpassffthigh)))), shading interp;
print -dpng lowpassffthighspac.png
surfl(fftshift(real(ifft2(highpassffthigh)))), shading interp;
print -dpng highpassffthighspac.png
surfl(fftshift(real(ifft2(highboostfft)))), shading interp;
print -dpng highboostfftspac.png
surfl(fftshift(real(ifft2(lowpassfftlow)))), shading interp;
print -dpng lowpassfftlowspac.png
surfl(fftshift(real(ifft2(highpassfftlow)))), shading interp;
print -dpng highpassfftlowspac.png

newlowpassffthigh  = lowpassffthigh.*imfft;
newhighpassffthigh = highpassffthigh.*imfft;
newhighboostfft    = highboostfft.*imfft;
newlowpassfftlow   = lowpassfftlow.*imfft;
newhighpassfftlow  = highpassfftlow.*imfft;

imwritesc((real(ifft2(newlowpassffthigh))), 'newlowpassffthigh.png');
imwritesc((real(ifft2(newhighpassffthigh))), 'newhighpassffthigh.png');
imwritesc((real(ifft2(newhighboostfft))), 'newhighboostfft.png');
imwritesc((real(ifft2(newlowpassfftlow))), 'newlowpassfftlow.png');
imwritesc((real(ifft2(newhighpassfftlow))), 'newhighpassfftlow.png');

imwritesc(im, 'im.png');