An image edge is a rapid local change in image intensity. Edge pixels often form curves or object boundaries when their local responses connect.

Main idea

A derivative converts intensity change into a large response. Flat regions give responses close to zero.


Edge Detection Pipeline

Edge detection has three stages:

  1. Edge filtering: Estimate gradient magnitude
  2. Edgel detection: Threshold the filtered response to find candidate edge pixels
  3. Edgel linking: Connect local edge elements into longer curves or boundaries

An edgel is one local edge element. It gives local evidence rather than a complete object boundary.


Review: Spatial Filtering

A spatial filter multiplies aligned image and mask values, then adds the products. For this neighbourhood and mask:

The response is:

This same multiply-and-sum process applies derivative masks to an image. See Image Filtering and Image Convolution for the general filtering process.

Mask orientation

In this note, means apply the displayed mask orientation to the aligned neighbourhood and sum the products. A true convolution flips an antisymmetric derivative mask and reverses the derivative sign. The gradient magnitude stays the same.


1-D Derivative Intuition

For neighbouring samples:

Signal regionDerivative responseMeaning
Flat regionClose to zeroIntensity changes very little
Step edgeLarge, narrow responseIntensity changes rapidly
Ramp edgeResponse spread over several pixelsIntensity changes gradually across a wider area

Image Gradient

In two dimensions, the gradient contains horizontal and vertical derivatives:

Its magnitude and direction are:

SymbolMeaning
Intensity derivative in the direction
Intensity derivative in the direction
Gradient magnitude, or edge strength
Gradient direction

Large means a strong local intensity change. Thresholding gives candidate edge pixels.


Prewitt Operator

Prewitt estimates the two gradient components with these masks:

Prewitt is simple and fast. Each mask combines differentiation in one direction with local averaging in the perpendicular direction.


Sobel Operator

Sobel gives more weight to the centre row or column:

The extra weight gives Sobel more smoothing than Prewitt.

Sobel as Two 1-D Passes

The vertical Sobel mask is separable:

Therefore, it can be applied as a differencing pass followed by a smoothing pass:

The horizontal Sobel mask uses the corresponding horizontal difference and vertical smoothing masks.


Gradient Magnitude Approximation

The exact magnitude is:

A faster approximation is:

The approximation avoids the square root while retaining a large response at strong intensity changes.


Limits of Raw Gradient Edges

ProblemEffect on the edge map
Noise sensitivitySmall unwanted changes create edge responses
Thick responsesOne boundary produces several neighbouring edge pixels
Weak or broken edgesA true boundary becomes incomplete after thresholding

Laplacian of Gaussian (LoG) reduces noise sensitivity through smoothing and finds edges at zero crossings. Canny Edge Detector adds smoothing, edge thinning, and reliable weak-edge linking.