Canny edge detector

Canny also produced a computational theory of edge detection explaining why the technique works.

Canny edge detection is a technique to extract useful structural information from different vision objects and dramatically reduce the amount of data to be processed.

Canny has found that the requirements for the application of edge detection on diverse vision systems are relatively similar.

Thus, an edge detection solution to address these requirements can be implemented in a wide range of situations.

The optimal function in Canny's detector is described by the sum of four exponential terms, but it can be approximated by the first derivative of a Gaussian.

This step will slightly smooth the image to reduce the effects of obvious noise on the edge detector.

It is important to understand that the selection of the size of the Gaussian kernel will affect the performance of the detector.

A 5×5 is a good size for most cases, but this will also vary depending on specific situations.

An edge direction falling in each color region will be set to a specific angle value, for instance, θ in [0°, 22.5°] or [157.5°, 180°] maps to 0°.

Minimum cut-off suppression of gradient magnitudes, or lower bound thresholding, is an edge thinning technique.

Lower bound cut-off suppression is applied to find the locations with the sharpest change of intensity value.

For example, In more accurate implementations, linear interpolation is used between the two neighbouring pixels that straddle the gradient direction.

The gradient magnitude at the central pixel must be greater than both of these for it to be marked as an edge.

However, some edge pixels remain that are caused by noise and color variation.

To account for these spurious responses, it is essential to filter out edge pixels with a weak gradient value and preserve edge pixels with a high gradient value.

The two threshold values are empirically determined and their definition will depend on the content of a given input image.

As both edge and noise will be identified as a high frequency signal, a simple Gaussian filter will add a smooth effect on both of them.

However, in order to reach high accuracy of detection of the real edge, it is expected that a more smooth effect should be applied to noise and a less smooth effect should be added to the edge.

[citation needed] The higher the discontinuity, the lower the weight value is set for the smooth filter at that point.

In order to resolve the challenges where it is hard to determine the dual-threshold value empirically, Otsu's method[3] can be used on the non-maximum suppressed gradient magnitude image to generate the high threshold.

Since the gradient magnitude image is continuous-valued without a well-defined maximum, Otsu's method has to be adapted to use value/count pairs instead of a complete histogram.

A mathematical morphology technique to thin the detected edge is developed by Mallat S and Zhong.

[4] Curvelets have been used in place of the Gaussian filter and gradient estimation to compute a vector field whose directions and magnitudes approximate the direction and strength of edges in the image, to which steps 3 - 5 of the Canny algorithm are then applied.

A variational explanation for the main ingredient of the Canny edge detector, that is, finding the zero crossings of the 2nd derivative along the gradient direction, was shown to be the result of minimizing a Kronrod–Minkowski functional while maximizing the integral over the alignment of the edge with the gradient field (Kimmel and Bruckstein 2003).

See the article on regularized Laplacian zero crossings and other optimal edge integrators for a detailed description.

Its parameters allow it to be tailored to recognition of edges of differing characteristics depending on the particular requirements of a given implementation.

For this reason, it is often suggested to use Rachid Deriche's infinite impulse response form of Canny's filter (the Canny–Deriche detector), which is recursive, and which can be computed in a short, fixed amount of time for any desired amount of smoothing.

The second form is suitable for real time implementations in FPGAs or DSPs, or very fast embedded PCs.

The image after a 5×5 Gaussian mask has been passed across each pixel
Gradient direction
Canny edge detection applied to a photograph