Corner detection

On this page 7

Corner detection is the computer vision technique that locates image points where intensity changes strongly in two different directions, such as the meeting point of two edges. These points, called corners or interest points, are distinctive enough to be found again in another image of the same scene, which makes them a foundation for feature matching, object tracking, image registration and 3D reconstruction.

Unlike an edge, which is ambiguous along its own length, a corner is well localized in both axes. That property lets algorithms anchor geometric reasoning to a sparse set of reliable points instead of processing every pixel.

How corner detection measures local image structure

Most classical detectors examine how the image intensity changes when a small window shifts in different directions. In a flat region, shifting the window changes almost nothing. Along an edge, shifting parallel to the edge changes little, while shifting across it changes the content substantially. At a corner, a shift in any direction produces a large change, and that is the signal a detector looks for.

The Harris detector formalizes this idea with the structure tensor, a 2×2 matrix built from summed products of the horizontal and vertical image gradients inside a weighted window. Its two eigenvalues describe the gradient energy along the two principal directions. Two small eigenvalues indicate a flat area, one large eigenvalue indicates an edge, and two large eigenvalues indicate a corner.

Because eigenvalue computation was costly, Harris and Stephens proposed the response R = det(M) – k * trace(M)^2, with an empirical constant k usually between 0.04 and 0.06. The Shi-Tomasi criterion instead uses the smaller eigenvalue directly, which tends to select corners that are better suited to tracking. The table below shows how the eigenvalues map to region types.

Eigenvalue patternRegion typeDetector response
Both smallFlat or uniform areaNear zero
One large, one smallEdgeNegative Harris response
Both largeCorner or textured pointLarge positive response
Interpreting structure tensor eigenvalues

After the response map is computed, the detector applies a threshold to reject weak candidates and non-maximum suppression to keep only the local peak in each neighborhood. Without suppression, a single physical corner would yield a cluster of adjacent detections.

Main corner detection algorithms

Corner detectors differ mainly in speed, repeatability and invariance. Gradient-based methods are accurate but slower, intensity-comparison methods are extremely fast, and learned detectors trade simplicity for robustness under difficult conditions.

DetectorPrincipleStrengthWeakness
MoravecMinimum intensity change over shiftsSimple, historical baselineAnisotropic, noise sensitive
HarrisStructure tensor responseRotation invariant, accurateNot scale invariant
Shi-TomasiMinimum eigenvalueGood for optical flow trackingNot scale invariant
FASTContiguous ring of brighter or darker pixelsVery fast, real timeNoise sensitive, no orientation
ORB keypointsFAST plus orientation over a pyramidFast with rotation handlingWeaker under strong blur
Learned detectorsNeural network keypoint headsRobust to lighting changesNeeds GPU and training data
Widely used corner detectors

FAST (Features from Accelerated Segment Test) tests a circle of 16 pixels around the candidate and accepts it when a contiguous arc, commonly 9 or 12 pixels, is all brighter or all darker than the center by a threshold. Its speed made it a standard choice in visual odometry and SLAM pipelines on embedded hardware.

Corners compared with edges and blob features

Corner detection is one member of a family of local feature detectors in computer vision. It is often confused with edge detection and with blob-based keypoint methods such as SIFT, yet each answers a different question about the image.

Feature typeWhat it findsLocalizationTypical use
CornerTwo-direction intensity changePrecise in both axesTracking, calibration
EdgeOne-direction intensity changePrecise across, ambiguous alongBoundaries, segmentation
BlobRegion differing from surroundingsCenter of a scale-space extremumScale-invariant matching
Learned keypointPoints scored by a networkDepends on the modelRobust matching
Corners versus related feature types

A corner detector only finds points; it does not describe them. To match corners between images, a pipeline adds a descriptor, such as BRIEF, ORB or a patch around the point, and compares those descriptors. Confusing detection with description is a common source of design errors.

Invariance and parameter choices in practice

The practical quality of a detector depends on repeatability, the probability that the same physical corner is detected again after a change in viewpoint, lighting or scale. Harris and Shi-Tomasi are invariant to rotation and fairly robust to additive brightness changes, but they are not scale invariant: a sharp corner at one zoom level may look like a rounded curve at another.

The usual remedy is to run the detector on an image pyramid and record the scale at which each corner was found. Other important parameters include the gradient smoothing scale, the window size, the response threshold and the minimum distance between accepted corners.

ParameterTypical settingEffect when increased
Window or block size3 to 7 pixelsFewer, more stable corners
Harris constant k0.04 to 0.06Fewer edge-like detections
Response thresholdRelative to maximum responseFewer, stronger corners
Minimum distance5 to 20 pixelsMore even spatial spread
Maximum corner countHundreds to a few thousandMore coverage, more compute
Key parameters and their effect

Limitations and common mistakes

Classical corner detection struggles with low texture, motion blur and image noise. A white wall offers almost no corners, while sensor noise in dark scenes creates false responses that do not repeat across frames. Repetitive patterns, such as windows on a facade, produce many corners that are individually valid but easy to mismatch.

  • Skipping Gaussian smoothing before gradient computation, which amplifies noise.
  • Using a global threshold on images with uneven lighting, which concentrates corners in bright areas.
  • Omitting non-maximum suppression, which produces clustered duplicate detections.
  • Expecting scale invariance from a single-scale Harris or Shi-Tomasi detector.

Learned keypoint detectors have reduced several of these problems, yet classical detectors remain widely used because they are deterministic, fast and easy to verify, which matters in calibration and embedded systems.

Stripped to the essentials

Corner detection teaches a computer to find the most recognizable points in a picture. Picture the corner of a window or the tip of a roof. These spots look different no matter which way you move a small magnifying glass around them.

A plain wall or a long straight line is hard to pin down, because many spots look the same. A corner is unique. Corners act like landmarks, so software can find the same points in the next photo or video frame and work out how things moved.

Where it is applied

An engineering team calibrating cameras for a warehouse robot photographs a printed checkerboard target from about 20 angles. Corner detection locates each inner checkerboard corner, and a refinement step adjusts every position to sub-pixel accuracy. From these points, the calibration software estimates the focal length and the lens distortion of each camera.

On the robot itself, a FAST detector extracts roughly 1,000 corners per frame at 30 frames per second on an embedded processor. Tracking those corners between frames lets the navigation system estimate how far the robot has moved. With accurate calibration and stable corners, the team keeps position drift to a few centimeters over a 50-meter aisle, which is good enough for the robot to dock reliably at charging stations.