# Edge detection

tags
Image processing

## Canny edge detection

Canny edge detection in the most famous edge detection algorithm, originally developed by John Canny in 1986.

The algorithm has 5 steps:

1. Smooth the image with Gaussian filtering.
2. Intensity gradients. First derivative in the horizontal ($$\mathbf{G}_x$$) and vertical ($$\mathbf{G}_y$$) directions are computed. Gradient intensity $$\mathbf{G} = \sqrt{\mathbf{G}_x^2 + \mathbf{G}_y^2}$$ and direction $$\mathbf{\Theta} = \text{atan2}(\mathbf{G}_y, \mathbf{G}_x)$$ are then computed.
3. Edge thinning to reduce blurring from the first two steps. Only largest edge intensity with respect to negative and positive gradient directions are preserved.
4. Double threshold to remove remaining edges caused by noise or color variation. Edge pixels are marked either as strong edge, weak edge or removed with two thresholds.
5. Only weak edge pixels connected to strong edge pixels are kept.

← Back to Notes