SIVP Toolbox
Last update : August, 2006
edge  Find edges in a single channel image.
Calling Sequence
 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, ...)
Parameters

im:
Input image which must be a single channel image.

method:
may be 'sobel'(default), 'prewitt', 'log', 'fftderiv' or 'canny'. Other methods will appear in the future.

thresh:
sets the threshold level, from 0 to 1. Defaults to 0.2. If negative, then the output image, E, will have the unthresholded gradient image.

direction:
may be 'horizontal', 'vertical' or 'both'(default). This determines the direction to compute the image gradient.

sigma:
Controls the ammount of highfrequency attenuation in some
methods (only the 'fftderiv' method uses this
parameter). This can be used to obtain different levels of
detail and to filter out highfrequency noise.

E:
edge image which is boolean matrix and has the same size as im.
If thresh<0, E is a double unthresholded image.
Description
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.
 E=edge(im, 'sobel', thresh, direction)

Detects edges in im, using the sobel gradient estimator.
 E=edge(im, 'prewitt', thresh, direction)

Detects edges in im, using the prewitt gradient estimator.
 E=edge(im, 'log', thresh, sigma)

Detects edges in 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.
 E=edge(im, 'fftderiv', thresh, direction, sigma)

Detects edges in im, using the FFT gradient method, default sigma 1.0
 E=edge(im, 'canny', thresh, sigma)

Detects edges in im, using Canny method.
thresh is a twoelement 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.
Examples
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));
Authors

Shiqi Yu <shiqi.yu[at]gmail.com>

Ricardo Fabbri <ricardofabbri[at]users.sf.net>
Bibliography
"Shape Analysis and Classification", L. da
F. Costa and R. M. Cesar Jr., CRC Press, section 3.3.
Availability
The latest version of SIVP can be found at
http://sivp.sourceforge.net
See Also
fspecial, imfilter, filter2,