Harris Corner Detection

Machine Learning
Introduced by
Chris Harris and Mike Stephens
Year
1988
Type
Interest point detector
Family
Corner detection

What does it do?

The Harris corner detector, introduced by Chris Harris and Mike Stephens in 1988, identifies corners and interest points in digital images.

A Harris corner is a point where image intensity changes strongly in more than one direction, which makes it a usable location for matching the same scene point across images. The method is used in image registration, motion estimation and 3D reconstruction.

The intuition behind the method

An edge is a place where intensity changes sharply in one direction only, while a corner is a place where it changes sharply in several directions. Harris detection tests this by asking how the intensity under a small window changes when the window is shifted in different directions. The method summarises the gradients in a neighbourhood with the structure tensor (also called the second-moment or auto-correlation matrix) and converts that matrix into a corner response score at each pixel. High response marks corner candidates, which are then filtered to give the final detections.

History

Harris and Stephens published their combined corner and edge detector at the Alvey Vision Conference in 1988. Their key idea was to derive corner and edge responses from the same structure tensor (also called the auto-correlation matrix) of image gradients. Förstner and Gülch (1987) described a related fast operator for detecting points, corners and circular centres in the same period. The Harris detector has since been widely used in computer vision, and it is still taught as a basic corner detector.

When to use it

Choose Harris corners when the images have clear two-dimensional structure and you need localised points that will be matched between views that differ only slightly, such as consecutive video frames or overlapping photographs. The method is also a reasonable choice when computational cost matters and the scale of the scene is roughly constant. Do not choose it when the images differ strongly in zoom, because the response is not scale-invariant. It is also a poor fit for heavily blurred images or repetitive textures, where few distinct corners exist. For large viewpoint or illumination changes, or when descriptors that are invariant to scale are needed, consider SIFT or a learned detector.

Limitations and considerations

  • The response is not scale-invariant: a corner that is detected at one zoom level may disappear or change response at another, because the window and derivative scales are fixed.
  • Along edges and on noisy or aliased textures, small gradient errors can push the response above the threshold at spurious points, so the amount of smoothing and the choice of threshold strongly affect the number of false corners.
  • Performance declines under large viewpoint changes or affine distortions, because the local gradient structure around a point changes with the viewing geometry.
  • Results depend on the window size, the Gaussian smoothing, the response threshold and the response formulation, so parameters often have to be tuned for each class of image.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • The response is built from the structure tensor, a quantity with a clear geometric meaning, so the detector's behaviour can be explained in terms of local gradient directions.
  • Only local gradient sums and a per-pixel response are required, so it is cheaper to compute than multi-scale pipelines such as SIFT.
  • The response depends on the eigenstructure of the tensor rather than on a fixed orientation, so detections are not tied to a particular image rotation.
  • Non-maximum suppression gives well-localised points, which is useful when the positions themselves are used for geometric alignment.

Applications

  • Image registration and alignment: matching corner positions across images to align medical scans or aerial photographs
  • Structure-from-motion: using corner correspondences across multiple views to recover 3D scene structure
  • Object tracking in video: tracking corner motion across frames to estimate object movement
  • Visual odometry in robotics: estimating robot motion by tracking corner features in successive camera frames
  • Feature-based image stitching: identifying overlapping regions in image pairs before blending them into panoramas

How it works

How it works

1

Compute image derivatives in the x and y directions with a derivative filter such as Sobel. Choose the size of the window used to accumulate gradient products and the threshold that will later be applied to the corner response. Both values are usually set empirically for the class of image being processed, as the limitations below describe.

2

No parameters are learned in this step. For each pixel, form the 2×2 structure tensor M by summing products of the x and y gradients over a neighbourhood, usually weighted by a Gaussian window. Compute a corner response R from M; the original Harris and Stephens formulation uses the determinant and trace of M, so explicit eigenvalue decomposition is not required.

3

Apply non-maximum suppression so that only local maxima of the corner response map remain, which prevents many detections from clustering around one corner. Threshold the remaining responses to keep the corner candidates, and refine their locations.

4

Assess the detections by repeatability: the fraction of corners that reappear at the same image location, within a stated pixel tolerance, after a known transformation such as a small rotation, a change of scale or a homography between the two views. Report the transformation, the pixel tolerance and the matching rule with the results, because repeatability values are not comparable across different settings.

Common pitfalls

  • Computing gradients without Gaussian smoothing produces noisy structure tensors and a large number of spurious detections.
  • Using one absolute response threshold across images with different contrast ranges can select many points in one image and almost none in another; normalising the image or the threshold is needed for comparable results.
  • Skipping non-maximum suppression leaves several adjacent responses above threshold around each true corner, which inflates the detection count and biases matching.
  • Expecting Harris detections to remain the same across large changes in scale; without a multi-scale extension, the detections are tied to the scale at which they were computed.

Frequently asked questions

What is the structure tensor M and how does it relate to corner detection?

The structure tensor (or auto-correlation matrix) M is a 2×2 matrix that captures the directional properties of image gradients in a small neighborhood. Its eigenvalues reveal the magnitude of intensity change in the principal directions: if both eigenvalues are large, the neighborhood contains a corner; if one is large and one small, it's an edge; if both are small, it's a flat region. Harris uses a response computed from M to score each pixel as a corner candidate.

Why is Gaussian smoothing applied before Harris corner detection?

Gaussian smoothing reduces noise and creates a more stable structure tensor by averaging gradients over a region. Without smoothing, small random intensity fluctuations produce misleading gradient patterns and spurious corner detections. The smoothing scale (sigma parameter) controls how large a neighborhood influences the corner response.

How does Harris compare to FAST corner detection?

FAST (Features from Accelerated Segment Test) is faster than Harris because it tests whether a contiguous set of pixels on a circle around a candidate point is brighter or darker than the candidate by a threshold, rather than computing a gradient-based response at every pixel. Harris is built on the structure tensor and gives a response that can be interpreted in terms of gradient directions, whereas FAST is an intensity test. ORB combines FAST detection with a descriptor for practical use.

Can Harris corners be made scale-invariant?

Not directly. The basic detector is tied to the scale of its window and derivative filters. Multi-scale variants apply the response across a scale-space pyramid and keep points that persist across scales, but this adds considerable computation. SIFT takes a different route: it locates extrema of difference-of-Gaussian responses across scale space and does not use the Harris response.

Related methods

Sources

  1. Harris, C., & Stephens, M. (1988). A combined corner and edge detector. Alvey Vision Conference, 147–152.

    Open publication reference
  2. Förstner, W., & Gülch, E. (1987). A fast operator for detection and precise localization of distinct points, corners and centres of circular features. ISPRS Intercommission Conference on Fast Processing of Photogrammetric Data, 281–305.

    Open publication reference