%%%%%%%%%%%%%%%%%%%%%%%%%%% CODE FOR THE AVERAGE & EDGE DETECTOR FILTERS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



clear all;

close all;

clc;

u=imread('londonbridge.jpg');

I=rgb2gray(u);

[r,c]= size(I)

I(1,1)=0;

for j=1:r

   for i=2:(c-1)
       I_avg_filter(j,i+1)=(I(j,i)+I(j,i+1))/2;
     
   end
   

end


for j=1:r

   for i=2:(c-1)
       I_edge_detector(j,i+1)=(I(j,i)-I(j,i+1));
     
   end
   

end

subplot(3,2,1);

imshow(u);

title('Original Image');

subplot(3,2,2);

imshow(I);

title('Original Image in Gray scale');

subplot(3,2,3);

imshow(I_avg_filter);

title('Image using Average Filter');

subplot(3,2,4);

imshow(I_edge_detector);

title('Image using Edge Detector');


--Apanja 10:06, 14 October 2009 (UTC)Ananya Panja

Alumni Liaison

Ph.D. on Applied Mathematics in Aug 2007. Involved on applications of image super-resolution to electron microscopy

Francisco Blanco-Silva