- 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:

- Smooth the image with Gaussian filtering.
- 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.
- Edge thinning to reduce blurring from the first two steps. Only largest edge intensity with respect to negative and positive gradient directions are preserved.
- 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.
- Only weak edge pixels connected to strong edge pixels are kept.