• canny(M, sigma, low, high)—Returns a binary edge image resulting from Canny edge detection on matrix M, using standard deviation sigma and hysteresis thresholds low and high. In the detection matrix the edge points have value 1 and the background has value 0. The perimeter of the image have undefined values, since the kernels do not fully overlap the image there.
This function uses Canny's algorithm for detecting edges in an image. Canny's edge detection algorithm consists of the following three stages:
1. Convolution of the input image with a derivative-of-Gaussian kernel, where sigma is the standard deviation of the Gaussian. sigma plays the role of a scale parameter for the edges: large values of sigma produce coarser scale edges and small values of sigma produce finer scale edges. Larger values of sigma also result in greater noise suppression.
2. Nonmaxima suppression along the direction of the intensity gradient for each pixel.
3. Hysteresis thresholding using the low and high threshold values. In hysteresis thresholding, the magnitudes of the intensity gradients are first thresholded using the lower threshold value. Then, pixels that have gradient magnitudes above the lower threshold, but with connected segments having at least one pixel with gradient magnitude larger than the higher threshold are retained.
Arguments
• M is an image matrix.
• sigma is a real number greater than zero, typically between 0 and 2.