The Canny algorithm is a popular edge detection algorithm that was first proposed by John F. Canny in 1986. It is a multi-stage algorithm that is widely used in image processing to detect a wide range of edges in an image.
The Canny algorithm consists of the following steps:
Gaussian smoothing: The image is first smoothed using a Gaussian filter to reduce noise and spurious details.
Gradient calculation: The image gradient is calculated using a set of filters such as the Sobel, Prewitt, or Roberts filters. The gradient magnitude and direction are calculated for each pixel in the image.
Non-maximum suppression: The gradient magnitude is then compared with its neighboring pixels in the gradient direction. Only the local maximum values are retained while the other pixels are suppressed.
Double thresholding: A double threshold is applied to the gradient magnitude to identify potential edges. Pixels with values above a high threshold are considered to be strong edges while pixels with values below a low threshold are considered to be weak edges.
Edge tracking by hysteresis: Weak edges that are adjacent to strong edges are also considered to be edges. This is achieved by tracking these weak edges until they terminate at another strong edge.
The Canny algorithm is very effective in detecting edges in an image and is widely used in computer vision and image processing applications. It is particularly useful in applications such as object recognition, image segmentation, and feature detection.