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
Source image and the result after a Canny edge detection
The EasyImage Canny edge detector operates on a grayscale BW8 image and delivers a black-and-white BW8 image where pixels have only 2 possible values: 0 and 255. Pixels corresponding to edges in the source image are set to 255; all others are set to 0. It can adjust the scale analysis, it doesn't allow sub-pixel interpolation and it delivers a binary image after thresholding.
Canny edge detector example
The Canny edge detector requires only two parameters:
- Characteristic scale of the features of interest: the standard deviation of the Gaussian filter used to smooth the source image.
- Gradient threshold with hysteresis: maximum magnitude of the gradient of the source image expressed as a fraction ranging from 0 to 1 (two values).
The API of the Canny edge detector is a single class, ECannyEdgeDetector, with the following methods:
- Apply: applies the Canny edge detector on an image/ROI.
- GetHighThreshold: returns the high hysteresis threshold for a pixel to be considered as an edge.
- GetLowThreshold: returns the low hysteresis threshold for a pixel to be considered as an edge.
- GetSmoothingScale: returns the scale of the features of interest.
- GetThresholdingMode: returns the mode of the hysteresis thresholding.
- ResetSmoothingScale: prevents the smoothing of the source image by a Gaussian filter.
- SetHighThreshold: sets the high hysteresis threshold for a pixel to be considered as an edge.
- SetLowThreshold: sets the low hysteresis threshold for a pixel to be considered as an edge.
- SetSmoothingScale: sets the scale of the features of interest.
- SetThresholdingMode: sets the mode of the hysteresis thresholding.
The result image must have the same dimensions as the input image.