GETEDGES gets the Sobel edge image. USAGE: imge=getedges(img) [imge,ix,iy]=getedges(img) INPUTS: img: grayscale double image OUTPUTS: imge: the edge image ix: x component gradient image iy: y component gradient image
0001 function [imge,ix,iy]=getedges(img) 0002 % GETEDGES gets the Sobel edge image. 0003 % 0004 % USAGE: 0005 % imge=getedges(img) 0006 % 0007 % [imge,ix,iy]=getedges(img) 0008 % 0009 % INPUTS: 0010 % img: grayscale double image 0011 % 0012 % OUTPUTS: 0013 % imge: the edge image 0014 % 0015 % ix: x component gradient image 0016 % 0017 % iy: y component gradient image 0018 0019 dx =[-1 0 1; -2 0 2;-1 0 1]; 0020 dy = dx'; 0021 ix = conv2(img, dx, 'same'); 0022 iy = conv2(img, dy, 'same'); 0023 0024 imge=gscale(sqrt(ix.^2+iy.^2),'minmax');