www.pudn.com > edgeExtraction.rar > robertEdge.m, change:2012-03-20,size:679b


function edgeImg = robertEdge( origImg ) 
%UNTITLED3 Summary of this function goes here 
%Robert㹫ʽ 
%G[f(x,y)]={[f(x,y)^0.5-f(x+1,y+1)^0.5]^2+[f(x+1,y)^0.5-f(x,y+1)^0.5]^2}^0.5 
%   Detailed explanation goes here 
 
meanImg = (origImg(:,:,1)+origImg(:,:,2)+origImg(:,:,3))/3; 
%sqrtImg = meanImg.^(1/2); 
sqrtImg =uint8( double(meanImg).^(1/2)); 
[a,b] = size(sqrtImg); 
A = sqrtImg(1:a-1,1:b-1) - sqrtImg(2:a,2:b); 
B = sqrtImg(1:a-1,2:b) - sqrtImg(2:a,1:b-1);  
edgeImg = A.^2 +B.^2; 
%edgeImg =double( edgeImg).^(1/2) * 255; 
%edgeImg(find(edgeImg > 255)) = 255; 
edgeImg =double( edgeImg).^(1/2); 
edgeImg(find(edgeImg ~= 0)) = 255; 
edgeImg =uint8(edgeImg); 
end