Line 37: Line 37:
 
      
 
      
 
end
 
end
 +
 
subplot(3,2,1);
 
subplot(3,2,1);
 +
 
imshow(u);
 
imshow(u);
 +
 
title('Original Image');
 
title('Original Image');
 +
 
subplot(3,2,2);
 
subplot(3,2,2);
 +
 
imshow(I);
 
imshow(I);
 +
 
title('Original Image in Gray scale');
 
title('Original Image in Gray scale');
 +
 
subplot(3,2,3);
 
subplot(3,2,3);
 +
 
imshow(I_avg_filter);
 
imshow(I_avg_filter);
 +
 
title('Image using Average Filter');
 
title('Image using Average Filter');
 +
 
subplot(3,2,4);
 
subplot(3,2,4);
 +
 
imshow(I_edge_detector);
 
imshow(I_edge_detector);
 +
 
title('Image using Edge Detector');
 
title('Image using Edge Detector');
 +
 
--[[User:Apanja|Apanja]] 09:59, 14 October 2009 (UTC)Ananya Panja
 
--[[User:Apanja|Apanja]] 09:59, 14 October 2009 (UTC)Ananya Panja

Latest revision as of 05:01, 14 October 2009

%%%%%%%%%%%%%%%%%%%%%%%%%%%% 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 09:59, 14 October 2009 (UTC)Ananya Panja

Alumni Liaison

Meet a recent graduate heading to Sweden for a Postdoctorate.

Christine Berkesch