(New page: %%%%%%%%%%%%%%%%%% CODE FOR THE AVERAGE & EDGE DETECTOR FILTERS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ---- clear all; close all; clc; u=imread('londonbridge.jpg'); I=rgb2gray(u); [...)
 
Line 1: Line 1:
 
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%% CODE FOR THE AVERAGE & EDGE DETECTOR FILTERS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%% CODE FOR THE AVERAGE & EDGE DETECTOR FILTERS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
  
 
----
 
----
Line 7: Line 6:
  
 
clear all;
 
clear all;
 +
 
close all;
 
close all;
 +
 
clc;
 
clc;
 +
 
u=imread('londonbridge.jpg');
 
u=imread('londonbridge.jpg');
  
 
I=rgb2gray(u);
 
I=rgb2gray(u);
 +
 
[r,c]= size(I)
 
[r,c]= size(I)
 +
 
I(1,1)=0;
 
I(1,1)=0;
 +
 
for j=1:r
 
for j=1:r
 +
 
     for i=2:(c-1)
 
     for i=2:(c-1)
 +
 
         I_avg_filter(j,i+1)=(I(j,i)+I(j,i+1))/2;
 
         I_avg_filter(j,i+1)=(I(j,i)+I(j,i+1))/2;
 
        
 
        

Revision as of 06:00, 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

Followed her dream after having raised her family.

Ruth Enoch, PhD Mathematics