edge — Find edges in a single channel image.
E = edge(im, method) E = edge(im, method, thresh) E = edge(im, method, thresh, direction) E = edge(im, method, thresh, sigma) [E, thresh] = edge(im, method, ...)
E
, will have the un-thresholded gradient image.
im
.
If thresh<0
, E
is a double un-thresholded image.
The function edge performs edge detection on a grayscale intensity image. The user may set the method, the threshold level, the direction of the edge detection, etc.
im
, using the sobel gradient estimator.
im
, using the prewitt gradient estimator.
im
, using the the Laplacian of Gaussian method.
sigma
is the standard deviation of the LoG filter
and the size of the LoG filter is nxn, where n = ceil(sigma*3)*2+1.
The default value for sigma
is 2.
im
, using the FFT gradient method, default sigma 1.0
im
, using Canny method.
thresh
is a two-element vector, in which the fist element is the low threshold
and the seond one is the high threshold. If thresh
is a scalar,
the low threshold is 0.4*thresh
and the high one is thresh
.
Besides, thresh
can not be negative scalar.
sigma
is the Aperture parameter for Sobel operator, which must be 1, 3, 5 or 7.
default thresh 0.2; default sigma 3.
Supported classes: INT8, UINT8, INT16, UINT16, INT32, DOUBLE.
im = imread('lena.png'); im = rgb2gray(im); E = edge(im, 'sobel'); imshow(E); E = edge(im, 'canny', [0.06, 0.2]); imshow(E); E = edge(im, 'sobel', -1); imshow(mat2gray(E));