Second Derivative
f(x)' analyzed to find changes in intensity f(x)'' analyzed to find edges
Zero-crossing occurs when function shifts from positive to negative sign or vice versa
The Marr–Hildreth detector first smooths the image with a Gaussian, applies the Laplacian, and identifies significant zero crossings.
Zero-crossing conditions
A zero crossing is a sign change: + to − or − to +, including cases where a zero lies between the opposite signs.
| Sign pattern | Zero crossing |
|---|---|
| + then − | Yes |
| + then 0 then − | Yes |
| − then + | Yes |
| − then 0 then + | Yes |
LoG (Laplacian of Gaussian) filter: Gaussian Smoothing + Laplacian Combined filter
This is the Laplacian of a normalized 2D Gaussian. Multiplying by a nonzero constant, including a sign change, leaves its zero-crossing locations unchanged.
Normalization note: this expression differentiates a normalized two-dimensional Gaussian. The notebook uses a differently scaled LoG. Multiplying the whole filter by a nonzero constant preserves its zero crossings, although it changes response magnitudes and the appropriate numerical thresholds.
Example sampled Laplacian-of-Gaussian kernel from the notes.
Slope of zero crossing {a, -b} is |a+b|
Threshold is applied to mark strong edges
Separability of LoG
2D Gaussian can be separated into two 1D filters
The subscripts x and y indicate one-dimensional convolution along the corresponding image axis. This is the nested-convolution form of the two separable terms.
This reduces computational complexity 2D conv: , Separated conv:
The Laplacian of Gaussian is a sum of two separable terms:
Gaussian separability lets each term be computed using 1D filtering along x and y.
Sigma = 1 → Detects fine details and noise.
Sigma = 3 → Balanced edge detection.
Sigma = 6 → Captures only prominent edges.
An n×n filter costs roughly n² operations per output pixel. Gaussian filtering uses two length-n passes; LoG can be computed as the sum of two such separable terms, costing roughly 4n.
Canny Edge Detection: multi-stage algorithm to detect edges in image with noise reduction and accurate edge localization. Consists of five steps:-
- Smoothing image using Gaussian Filter smoothing to remove noise.
Large σ (2.0–3.0): Detects larger edges (smoother image, less noise).
Small σ (0.5–1.0): Detects fine details (may be noisy).
- Computing Gradient Magnitude and Orientation using Sobel filters in X and Y directions.
- Performing Non-Maximum Suppression (NMS) to remove false edges. For each pixel (x, y) compute its gradients magnitude and direction, compare the pixel's gradient magnitude with its neighbors along the gradient direction, if the pixel is not the maximum, set it to 0

Each pixel’s gradient direction is classified into four categories:
0° (Horizontal) → Compare with left & right neighbors.
45° (Diagonal) → Compare with top-left & bottom-right.
90° (Vertical) → Compare with top & bottom.
135° (Diagonal) → Compare with top-right & bottom-left.
Suppress a pixel if its magnitude is smaller than either comparison neighbor along the gradient direction.
- Perform Hysteresis Thresholding to ensure only strong and meaningful edges remain. Define two thresholds High & Low

If gradient magnitude is above H → strong edge
If gradient magnitude is below L → not an edge
If gradient magnitude is between H and L→ weak edge
To determine if weak edge is an edge or not:
- 4-connected: pixel is edge if any one of (Top, Bottom, Left, Right) pixel is an edge
- 8-connected: pixel is edge if any neighbor is edge pixel

5.Final Edge Detection
Start from strong edges and track connected weak edges. Discard weak edges not connected to strong edges. In the end output Final Canny Edges.