% Lab3a_1 Spring 2005   Terje Natås
f=imread('Figurer.bmp'); 
f=im2double(f);
imshow(f)                % Figure 1 Display original image
pause
[M N]=size(f)         % Dimensions of input image 
g=f;                    % g is output image     
%w=[0 1 0;1 -4 1;0 1 0 ];
w=[1 1 1;1 1 1;1 1 1 ]/9;
for x=2:M-1
    for y=2:N-1
       g(x,y)=0; 
       for i=-1:1
           for j=-1:1
               g(x,y)=g(x,y)+f(x+i,y+j)*w(i+2,j+2);
           end
       end              
    end
end
figure; imshow(g);pause
close all                % Delets all windows 
