%This script will use blurring filters to make the image of lena look like
%she was moving during the snapshot.

f=imread('lena.tif');

%Here are the three blurring filters I'll use
h1=1/9*ones(1,9);
h2=fspecial('motion',9,90);
h3=fspecial('motion',15,30);

%Lenasize(1)=width of image in pixels 
%Lenasize(2)=height of image in pixels
lenasize=size(f);

fftf=fft2(f);
ffth1=fft2(h1,lenasize(1),lenasize(2));
ffth2=fft2(h2,lenasize(1),lenasize(2));
ffth3=fft2(h3,lenasize(1),lenasize(2));

figure;
subplot(2,2,1);
imagesc(abs(fftf));
subplot(2,2,2);
imagesc(abs(ffth1));
subplot(2,2,3);
imagesc(abs(ffth2));
subplot(2,2,4);
imagesc(abs(ffth3));

ffthorblur=ffth1.*fftf;
fftverblur=ffth2.*fftf;
fftdiagblur=ffth3.*fftf;

lenahorblur=ifft2(ffthorblur);
lenaverblur=ifft2(fftverblur);
lenadiagblur=ifft2(fftdiagblur);

lenahorblur=real(lenahorblur);
lenahorblur=lenahorblur/max(lenahorblur(:));
lenaverblur=real(lenaverblur);
lenaverblur=lenaverblur/max(lenaverblur(:));
lenadiagblur=real(lenadiagblur);
lenadiagblur=lenadiagblur/max(lenadiagblur(:));



