Canny Edge Detector

The Canny edge detector facilitates:

  • Good detection: finds all edges.

  • Good localization: the found edges are as close as possible to the “real” edges in the image.

  • Minimal response: one edge response is accepted for each position, i.e. avoiding multiple close or intersecting edge responses.

Input image.
Result of a Canny edge detection.

The EasyImage Canny edge detector produces a binary output image where pixels corresponding to edges are set to 255 and all others are set to 0.

The Canny edge detector can be configured with three parameters:

  • Scale of the features of interest: the standard deviation of the Gaussian filter used to smooth the source image, called the smoothing scale.

  • Gradient threshold with hysteresis: maximum magnitude of the gradient of the source image expressed as a fraction ranging from 0 to 1 (two values).

  • Threshold mode: which defines whether the threshold values should be interpreted as absolute or relative.

The API of the Canny edge detector is a single class, ECannyEdgeDetector .NET Python, with the following methods:

The result image must have the same dimensions as the input image. Its dimension must be set using SetSize .NET Python

See Also

Code Snippets

Easy to understand, ready to copy code snippets.

Canny Edge Detector
Harris Corner Detector

Detect corners in an image.

Harris Corner Detector
Morphological Gradient

Using morphological operators to detect edges.

Morphological Gradient
Scalar Gradient

Compute gradient magnitude and direction maps from a grayscale image.

Scalar Gradient