---
kind: concept
slug: canny-edge-detection
title: Canny edge detection
summary: >-
  Canny edge detection: a multi-stage gradient edge detector, here followed by a Hessian ridge filter. One source (2609.07408): as preprocessing for small tabular classifiers on spiral drawings, the Canny plus Hessian variant lowered AUC for 8 of 9 classifiers, and augmentation helped most. Author-reported, single-source page.
tags: [edge-detection, image-preprocessing]
papers: ["2609.07408"]
related: [feature-selection, random-forest, support-vector-machine, image-thresholding]
status: draft
updated_at: 2026-10-19
---

## Overview

Canny edge detection finds thin, connected edges in a grey-level image. The
steps are: smooth with a Gaussian, compute Sobel gradients, thin the gradient
ridges by non-maximum suppression, apply a double threshold, and keep weak
edges only where they connect to strong ones (hysteresis) [arxiv:2609.07408 p. 5]
[arxiv:2609.07408 p. 6] [arxiv:2609.07408 fig. 5]. The invariant all variants
share is this gradient-then-hysteresis chain, with the Gaussian width and the
thresholds as the main settings [arxiv:2609.07408 fig. 5].

Only one source card lists this concept so far, so the page describes one
paper's use of the detector and cannot compare variants across studies.

## Variants

### Canny followed by a Hessian ridge filter

The paper runs the Canny output through a second filter. For each pixel it
takes second derivatives, forms the 2 × 2 Hessian, and uses the
minimum-curvature eigenvalue as the edge intensity [arxiv:2609.07408 p. 7]
[arxiv:2609.07408 eq. 13]. The Gaussian sigma is 2.8, picked from 1, 2, 2.8
and 3 for this data [arxiv:2609.07408 fig. 5] [arxiv:2609.07408 p. 8]. The
pipeline is named "Canny + Hessian" in the paper's dataset variants DS1 and
DS3 [arxiv:2609.07408 p. 8]. Card:
[Impact of canny edge detection preprocessing on performance of machine learning models for Parkinson's disease classification](/papers/2609.07408).

### Raw images as the reference (no edge step)

The paper's comparison set includes the original images with no edge step
(DS0) and augmented originals (DS2) [arxiv:2609.07408 p. 8]. Canny is not
applied in these variants, so they show what the edge step adds or removes.

### Augmentation before or after the edge step

Augmentation is applied to the raw images (DS2) or to the Canny + Hessian
output (DS3). Each training image gets 71 augmented copies, rotated,
shifted, flipped and brightness-changed [arxiv:2609.07408 alg. 1]
[arxiv:2609.07408 p. 8]. The paper does not say whether the originals are kept
in the augmented sets [arxiv:2609.07408 p. 8].

## When to use which

The paper tests classic classifiers on one small dataset, so these are
hypotheses to check on your own data, not general rules. The claims below
come from the author-reported tables.

| Situation | Use | Why |
|---|---|---|
| Edge features are assumed to help a small classifier | Benchmark against raw input first | Canny + Hessian (DS1) gave lower AUC than raw images (DS0) for 8 of 9 models, and LR rose from 0.77 to 0.82 [arxiv:2609.07408 fig. 12] [arxiv:2609.07408 fig. 13] |
| Few training images, augmentation available | Augment the raw images (DS2) | Augmentation raised AUC for 6 of 9 models; RF, XGB and KNN reached about 0.97 [arxiv:2609.07408 fig. 13] |
| Memory is the tightest constraint | DT, NB, LR or XGB | Model sizes of 1.7 to 3.8 KB in the paper's table [arxiv:2609.07408 fig. 40] |
| Memory fixed by a model that does not grow with data | RF | About 61 KB on all four datasets [arxiv:2609.07408 fig. 40] |
| Latency matters on augmented data | Avoid SVM and KNN | SVM predictions took 9000 to 30000 ms on DS2, and KNN memory grew to 102 to 220 KB [arxiv:2609.07408 fig. 41] [arxiv:2609.07408 fig. 40] |

The paper's timings were measured on one notebook with an Intel Core i3-370M
and 8 GB RAM [arxiv:2609.07408 p. 7], so use the ratios, not the absolute
times, when planning your own budget.

## Implementation sketch

The Canny stages and the Hessian step, in the order the paper uses them. The
Hessian step is applied to the edge image, not to the grey image
[arxiv:2609.07408 p. 7] [arxiv:2609.07408 p. 8].

```pseudocode
# Canny edges, then a Hessian ridge measure  [arxiv:2609.07408 p. 5-8]
# Input:  grey image (H, W), intensities 0-255
# Output: edge-intensity map (H, W)

def canny_then_hessian(image):
    # Gaussian smoothing; sigma = 2.8 was chosen for DS1 and DS3
    # [arxiv:2609.07408 fig. 5]
    smoothed = gaussian_smooth(image, sigma=2.8)
    # Sobel gradient magnitude and angle of the smoothed image
    # [arxiv:2609.07408 eq. 6-8]
    magnitude, angle = sobel_gradient(smoothed)
    # Thin the edges by non-maximum suppression, as the text prints it
    # [arxiv:2609.07408 p. 6] [arxiv:2609.07408 fig. 3]
    thin = non_maximum_suppression(magnitude, angle)
    # Double threshold, both values 51, then hysteresis
    # [arxiv:2609.07408 fig. 5]
    edges = hysteresis(thin, low=51, high=51)
    # Second derivatives of the edge image [arxiv:2609.07408 eq. 10-12]
    ixx, iyy, ixy = second_derivatives(edges)
    # Mean curvature and the root term of the 2 x 2 eigenvalue formula
    # [arxiv:2609.07408 eq. 13]
    mean_curvature = (ixx + iyy) / 2
    root = sqrt(mean_curvature**2 - (ixx * iyy - ixy**2))
    # Edge intensity is the minimum-curvature eigenvalue
    # [arxiv:2609.07408 p. 7]
    return mean_curvature - root
```

## Contradictions

None known across papers; only one source so far. Within that paper, the
conclusion says SVM "excelled on augmented datasets" [arxiv:2609.07408 p. 35],
but its DS2 median accuracy in the box plot is 0.50 [arxiv:2609.07408 fig. 42].
The paper does not explain the gap.

## Papers

- [Impact of canny edge detection preprocessing on performance of machine learning models for Parkinson's disease classification](/papers/2609.07408): compares nine classifiers with and without Canny + Hessian preprocessing and augmentation on spiral drawings; author-reported, 10-fold cross-validation, no held-out test set.
