AI Glossary / Computer vision and multimodal AI / Intermediate
Harris corner detector
Definition
The Harris corner detector identifies image locations where brightness changes strongly in more than one direction. It uses local image gradients to distinguish corner-like structures from edges and relatively flat regions, producing candidate points that can support matching, tracking, and other computer vision tasks.
What it means
A flat patch looks similar when moved slightly in any direction. Along an edge, moving across the edge changes the patch strongly, while moving along it changes little. Around a corner-like feature, small movements in several directions change the appearance.
The detector formalizes this intuition using a local second-moment matrix, often called the structure tensor. A response derived from that matrix indicates how corner-like the neighborhood is.
A detected “corner” need not be the physical corner of an object. Texture junctions and other distinctive intensity patterns can also produce strong responses. The detector finds local image structure rather than semantic meaning.
How it works
Calculate horizontal and vertical image gradients. Within a local weighted window, accumulate squared gradients and their products into a two-by-two matrix M.
Its two eigenvalues summarize intensity variation in two principal directions. Both small suggests a flat region; one large and one small suggests an edge; both large suggests a corner-like region.
The Harris response commonly uses R = determinant(M) − k × trace(M)², avoiding explicit eigenvalue calculation. A threshold and nonmaximum suppression select strong, spatially localized candidates.
Window size, smoothing, gradient calculation, response threshold, and suppression settings affect the points found. The basic detector is not inherently scale-invariant, so a feature can behave differently when image resolution or object size changes.
Three practical examples
1. Image alignment: A pipeline detects distinctive points in overlapping images before describing and matching them.
2. Motion tracking: A prototype chooses corner-like patches whose locations can be followed more reliably than uniform regions.
3. Calibration preparation: Engineers inspect strong image features in a controlled pattern as part of a broader geometric measurement process.
Think of it this way
Think of locating yourself on a map. A long straight road gives limited information about position along it, while a distinctive junction helps constrain position in several directions.
The analogy is limited because the Harris detector examines local brightness variation, not roads or meaningful landmarks. Repeated junction-like textures can still create ambiguous matches, and a strong local response does not guarantee stability across viewpoints.
Worked example
Use k = 0.04 in a simplified example. If the structure tensor has eigenvalues 10 and 10, its determinant is 100 and its trace is 20. The response is 100 − 0.04 × 400 = 84.
For an edge-like patch with eigenvalues 10 and 0.1, the determinant is 1 and the trace is 10.1. The response is 1 − 0.04 × 102.01 = −3.0804.
For a weakly varying patch with eigenvalues 0.1 and 0.1, the response is 0.01 − 0.04 × 0.04 = 0.0084.
The corner-like patch has a much stronger positive response in these illustrative units. A real threshold depends on gradient scaling, windowing, and image conditions; these numerical values are not universal detection thresholds.
Illustrative case study
Fictional case: Willow Mapping aligns photographs of a printed board. Harris points provide candidates, but repeated grid intersections produce several plausible matches.
The team adds descriptors and geometric consistency checks instead of assuming every strong corner has a unique partner. Images taken at a very different scale also change which points are detected, prompting a review of the representation.
The fictional case illustrates the distinction between detecting a useful local feature and establishing a correct correspondence. No alignment accuracy is assumed merely because many corner responses are present.
Common misconceptions and mistakes
The detector does not recognize objects or assign identities to physical corners. It finds patterns in intensity variation.
Rotation-related properties do not imply full invariance to scale, perspective, lighting, blur, or sampling. Practical behavior depends on the image and implementation.
A high response is not a probability that a point is correct. It is a score derived from local gradients.
Do not skip matching validation. Repeated textures can yield many strong but ambiguous points, while image noise can create unstable responses unless preprocessing and thresholds are suitable.
Business use
The Harris detector is a useful classical building block and baseline for controlled vision tasks. It is computationally interpretable and can help explain why some image regions are easier to track than others.
Evaluate repeatability across the actual camera conditions, not just the number of detected points. Inspect spatial coverage, ambiguous repeated patterns, and downstream matching quality. Use appropriate scale handling or another feature method if the task requires substantial size changes. Treat detection, description, matching, and geometric verification as separate responsibilities in the pipeline.
People also ask
Does it need labeled training images?
The classical detector does not require learned parameters from labeled examples, although its settings still need selection and evaluation.
Is an edge useless for tracking?
Not always, but a straight edge gives weaker localization along its direction than a corner-like patch.
Does Harris provide a feature descriptor?
The detector identifies locations and responses. A separate descriptor is generally needed for matching across images.
Check your understanding
A patch changes strongly when shifted horizontally but hardly changes when shifted vertically. Is that the ideal Harris corner pattern?
Answer: No. It is more edge-like because variation is strong in only one principal direction. A corner-like patch has substantial variation in two directions.
Related terms
- Image gradient
- Structure tensor
- Eigenvalue
- Feature descriptor
- Optical flow
- corner response
- nonmaximum suppression
- image matching
Learn next
Learn image gradients and then compare flat, edge, and corner patches by shifting small windows. Calculate the Harris response for simple two-by-two matrices. Finally match detected points across two images and inspect why descriptors and geometric checks are needed after detection.
More in Computer vision and multimodal AI
- Hankel transform - The Hankel transform is an integral transform using Bessel functions that is especially useful for problems with radial or cylindrical symmetry.
- Harmonic function - A harmonic function is a sufficiently smooth scalar function whose Laplacian is zero within a region.
- Harmonization - Image harmonization adjusts the appearance of image elements so they look visually consistent when combined.
- Hartley transform - The Hartley transform is a real-valued transform closely related to the Fourier transform.
- Hausdorff distance - Hausdorff distance measures the greatest nearest-neighbor separation between two sets of points.
- Hays - Efros scene completion - Hays - Efros scene completion is a research approach that fills missing image regions by retrieving compatible content from a very large photograph collection.
Sources
Chris Harris and Mike Stephens, “A Combined Corner and Edge Detector,” Alvey Vision Conference, 1988. Primary paper consulted for the local variation model and corner-response formulation: https://web.stanford.edu/class/cs231m/references/harris-stephens.pdf
The eigenvalue calculations and mapping case are original teaching illustrations. They do not specify universal parameter settings or reproduce an empirical benchmark.
Previous: Harmonization Next: Hartley's test