www.pudn.com > Smoothed_Sobel_Gradient.rar > Smoothed_Sobel_Gradient.m, change:2008-10-07,size:442b


function Smoothed_Sobel_Gradient 
f = imread('Fig3.46(a).jpg'); 
[width, height] = size(f); 
g = uint8(zeros(width,height)); 
for i = 2:width-1 
    for j = 2:height-1 
         g(i,j)=abs( f(i+1,j-1) + 2*f(i+1,j) + f(i+1,j+1) - f(i-1,j-1) - 2*f(i-1,j) - f(i-1,j+1) )+abs( f(i-1,j+1)- f(i-1,j-1) +  2*f(i,j+1)- f(i,j-1) + f(i+1,j+1)  - f(i+1,j-1) );  
    end 
end 
g = g; 
figure('Name','SobelӼͼ','NumberTitle','off'),,imshow(g);