Canny Edge Detection
Canny Edge Detection Algorithm · Also known as: Canny operator, Canny edge detector
The Canny edge detector, introduced by John Canny in 1986, is a multi-stage algorithm for identifying edges in digital images where significant intensity changes occur. Canny's method is optimal for step edges in additive Gaussian noise and remains the gold standard for edge detection in computer vision due to its mathematical elegance and practical effectiveness.
Read the full method
Sign in with a free account to read this section.
Method map
The neighbourhood of related methods — select a node to explore.
When to use it
Use Canny edge detection as a preprocessing step for shape detection (Hough Transform), contour analysis, or image segmentation. Canny is particularly effective for detecting straight or smooth curves in images with sufficient contrast and manageable noise. Avoid Canny when dealing with very textured or noisy images where edge clarity is poor, or when precise sub-pixel edge localization is needed; consider learned edge detectors for complex scenes.
Strengths & limitations
- Mathematically optimal for detecting step edges in Gaussian noise
- Produces thin, well-defined edge maps with single-pixel-wide contours
- Hysteresis thresholding effectively suppresses noise while preserving true edges
- Simple to understand and implement; efficient computational complexity
- Widely available in image processing libraries and well-established standard
- Sensitive to threshold selection; poor choice of thresholds results in too many false positives or missed edges
- Smoothing (Gaussian blur) can blur fine edges or small features
- Assumes edges are step-like; performs poorly on textured boundaries or soft transitions
- Does not distinguish between true object boundaries and internal texture edges
Frequently asked
What is non-maximum suppression (NMS) and why is it necessary?
Non-maximum suppression thins the gradient magnitude map by suppressing pixels that are not local maxima along the gradient direction. This step is crucial because Gaussian derivatives produce thick gradient responses near edges. By keeping only the locally strongest responses (perpendicular to the edge direction), NMS produces single-pixel-wide edge contours. Without NMS, edge maps would be thick and diffuse.
How do the two thresholds in hysteresis thresholding work?
Canny uses two thresholds: a high threshold (e.g., 0.3 × max gradient) and a low threshold (e.g., 0.1 × max gradient). Pixels above the high threshold are immediately classified as edges. Pixels below the low threshold are rejected. Pixels between the thresholds are kept only if they are connected to pixels above the high threshold. This hysteresis mechanism suppresses noise while preserving thin, weakly-defined edges that are part of true contours.
Why use Gaussian blur before gradient computation?
Gaussian blur reduces noise before computing gradients. Since gradient operators are sensitive to high-frequency noise, smoothing first ensures that detected edges correspond to true intensity changes rather than noise. The smoothing scale (Gaussian sigma) is a tuning parameter: larger sigma removes more noise but also blurs edges; smaller sigma preserves edge sharpness but may be sensitive to noise.
How should threshold values be chosen?
Threshold selection depends on image contrast and noise level. A common heuristic is to use high threshold = 0.2–0.3 × max gradient and low threshold = 0.05–0.1 × max gradient. Alternatively, Otsu's method or histogram analysis can suggest thresholds. For interactive applications, thresholds can be exposed as sliders. For batch processing, automated threshold selection methods (e.g., based on image statistics) are preferable.
Sources
- Canny, J. (1986). A computational approach to edge detection. IEEE Transactions on Pattern Analysis and Machine Intelligence, 8(6), 679–698. DOI: 10.1109/TPAMI.1986.4767851 ↗
- Sobel, I., & Feldman, G. (1968). A 3x3 isotropic gradient operator for image processing. Pattern Recognition and Machine Intelligence, 271–272. link ↗
How to cite this page
ScholarGate. (2026, June 3). Canny Edge Detection Algorithm. ScholarGate. https://scholargate.app/en/computer-vision/canny-edge-detection
Which method?
Set this method beside its closest kin and read them side by side — the library lays the books on the table; the choice is yours.
- Contour AnalysisComputer Vision↔ compare
- Harris Corner DetectionComputer Vision↔ compare
- Hough TransformComputer Vision↔ compare
- Image Morphology OperationsComputer Vision↔ compare
- Template MatchingComputer Vision↔ compare