Chapter 7: Feature Detection and Matching
Points, patches, edges, contours, lines, vanishing points, and segmentation techniques.
- Topics
- 4
- Demo
- 1
- Videos
- 3
- Min read
- 29
Chapter Overview
How do we find corresponding points between two images? This classic problem underlies image stitching, 3D reconstruction, object tracking, and more. The solution: find distinctive features and match them.
What is this chapter about? We study how to detect interesting points (corners, blobs), describe them in a way that's robust to changes in viewpoint and lighting, and match them between images.
Why does this matter? Feature matching is the foundation for:
- Panorama stitching: Finding overlapping regions between photos
- Visual SLAM: Tracking camera motion through a scene
- Object recognition: Matching templates to images
- Image retrieval: Finding similar images in a database
How the topics connect: We start with feature detectors that find interesting points—corners, blobs, edges. Then feature descriptors encode the local appearance around each point. Finally, we learn matching strategies that robustly pair up corresponding features despite noise and outliers.
Chapter Roadmap
Click any topic to jump in
Feature Detectors
Harris, SIFT, FAST, and ORB — finding distinctive points like corners and blobs that are repeatable across views.
Edge Detection
Gradients, Sobel, Canny, and LoG — finding boundaries and contours through intensity change analysis.
Feature Descriptors
SIFT and BRIEF descriptors, ratio test, and cross-check — encoding local appearance for robust matching.
Hough Transform
Accumulator-based voting for lines and circles — detecting structured geometric shapes from edge pixels.
Topics
4 topics in this chapter
Chapter 6 taught networks to recognize whole objects, but a different family of vision tasks — stitching a panorama, tracking a camera through a room, reconstructing 3D from photos — hinges on a lower-level question: which individual points in two images correspond to the same physical spot? You cannot match every pixel, because most pixels look like their neighbours and matching them is hopelessly ambiguous. The trick is to first find a sparse set of points that are both distinctive, so they stand out from their surroundings, and repeatable, so the same world point is found again after the viewpoint or lighting changes. Corners fit both criteria beautifully: unlike a flat wall or a straight edge, a corner is pinned down in two directions at once. This topic surveys how detectors find such points. The Harris detector reads local gradient structure, SIFT adds scale invariance through a scale-space search, and FAST and ORB trade some robustness for the raw speed that real-time SLAM demands.
Definition
A feature detector is an algorithm that locates sparse, distinctive, and repeatable interest points — typically corners or blobs — in an image, so that the same physical points can be re-found reliably across different views for subsequent description and matching.
In this topic
- 1Harris Corner Detector
- 2SIFT Keypoints
- 3FAST Corner Detector
- 4ORB Features
Harris Corner Detector
A good interest point should change in appearance no matter which direction you shift a small window over it — that is what makes a corner, and the Harris detector measures it. It builds the structure tensor from image gradients and summed over a window, where is the matrix of gradient products. The two eigenvalues of summarise the local shape: both large means a corner, one large means an edge, both small means a flat region. Rather than solve for eigenvalues, Harris scores each pixel with , using sensitivity near 0.05. Its weakness is scale: a corner at one zoom can read as an edge at another, which is exactly the gap SIFT closes.
The structure tensor is a symmetric positive semi-definite matrix. Its eigenvalues characterize local gradient distribution: both large (corner), one large (edge), both small (flat). The Harris response avoids explicit eigenvalue computation (which requires solving a quadratic) by using the determinant-trace relationship. The parameter controls sensitivity: larger requires both eigenvalues to be more equal. Harris corners are rotation-invariant because eigenvalues of are invariant under rotation, but NOT scale-invariant — a corner detected at one scale may be an edge at another.
SIFT Keypoints
Harris finds corners at a single scale, but a building corner photographed up close and far away needs to match despite the size change. SIFT earns scale invariance by searching a scale-space: the image is repeatedly blurred with Gaussians at increasing , and adjacent blurred images are subtracted to form the Difference of Gaussians , which cheaply approximates the scale-normalised Laplacian — the optimal blob detector. Keypoints are the local extrema of across both space and scale, so each feature is detected at its own characteristic size. Low-contrast and edge-like extrema are discarded to keep only stable points. This scale search is more expensive than Harris but is what lets SIFT features match across zoom and, with a descriptor, across viewpoint.
SIFT builds a scale-space by convolving with Gaussians at . The Difference of Gaussians approximates the scale-normalized Laplacian, which is the optimal blob detector. Keypoints are local extrema in 3D space — compared against 26 neighbors (8 spatial + 9 above + 9 below). Sub-pixel localization fits a 3D quadratic and solves . Keypoints with (low contrast) or edge ratio (typically ) are rejected.
FAST Corner Detector
SIFT is robust but far too slow for a phone tracking its own motion at 30 frames per second, so FAST trades invariance for raw speed. It examines a ring of 16 pixels on a Bresenham circle around a candidate centre and declares a corner when contiguous ring pixels are all brighter than or all darker than , with the common choice. A learned decision tree first tests only the four compass points, rejecting most non-corners in a couple of comparisons, which is why FAST runs tens of times faster than Harris. The cost of that speed is real: FAST is not scale-invariant, assigns no orientation, and fires many adjacent detections, so non-maximum suppression on corner strength is needed to thin them.
FAST examines a Bresenham circle of 16 pixels at radius 3 around candidate pixel . The test checks if contiguous pixels are all brighter than or all darker than . For FAST-12 (), a corner requires 12 of 16 contiguous pixels to pass. The algorithm uses a decision tree learned from training images to achieve average-case per pixel: it first checks pixels 1, 9, then 5, 13 (the cardinal directions). If none of the four cardinal pixels deviate from by more than , the point is rejected immediately. This early rejection makes FAST 20-40x faster than Harris. However, FAST lacks sub-pixel precision, has no orientation assignment, and detects many adjacent corners — non-maximum suppression using the sum of absolute differences (corner strength) is needed.
ORB Features
FAST is quick but bare — no orientation and no descriptor — and SIFT, while excellent, was long patent-encumbered. ORB (Oriented FAST and Rotated BRIEF) fuses the best of both into a free, real-time package. It takes FAST keypoints and assigns each an orientation from the intensity centroid, the direction from the patch centre to its centre of mass, giving rotation awareness that plain FAST lacks. It then computes a rotated BRIEF binary descriptor aligned to that orientation, so the same point yields the same bits even when the camera rolls. Because the descriptor is a bit string, matching uses Hamming distance — a single XOR and popcount — making ORB dramatically cheaper than SIFT's floating-point vectors. This is why ORB underpins so many real-time SLAM and mobile pipelines, connecting the corner idea back to the descriptor topic that follows.
ORB combines oFAST and rBRIEF. The orientation is computed from the intensity centroid: where are image moments within a patch. This gives rotation invariance — the descriptor is computed relative to . rBRIEF computes 256 binary comparisons on a rotated sampling pattern: where is the rotation matrix. The sampling pairs are preselected to maximize variance and minimize correlation. Matching uses Hamming distance — counting differing bits with XOR and POPCOUNT, which is a single CPU instruction. This makes matching with tiny constant, far faster than Euclidean distance on real-valued descriptors.
Theory Exercise
Problem:
The structure tensor M at a pixel has eigenvalues λ₁=100 and λ₂=5. Using k=0.04, compute the Harris response R. Is this a corner, edge, or flat region?
Hints:
- det(M) = λ₁ × λ₂
- trace(M) = λ₁ + λ₂
- R = det(M) - k × trace(M)²
- Corners have high R, edges have R ≈ 0, flat regions have R small
Related Problems on PixelBank
The previous topic found repeatable keypoints, but a location alone cannot be matched — knowing there is a corner at pixel (312, 88) in one image says nothing about which corner it corresponds to in another. To match, we need to describe the appearance around each keypoint as a compact signature, and that signature must survive the very transformations that separate two views: rotation, scale change, and shifts in brightness. A good descriptor gives the same physical point nearly the same vector from any reasonable viewpoint, while giving different points clearly different vectors. This topic builds that machinery in two halves. First come the descriptors themselves: the classic SIFT descriptor, which summarises local gradients into a 128-dimensional histogram, and the binary BRIEF descriptor, which trades some robustness for tiny size and blazing match speed. Then come the matching strategies that decide which descriptors actually correspond — Lowe's ratio test, which rejects ambiguous matches, and cross-check, which demands mutual agreement — turning raw descriptor distances into a trustworthy set of correspondences.
Definition
A feature descriptor is a compact, distinctive encoding of the local image appearance around a keypoint, designed to be invariant to rotation, scale, and illumination, so that descriptors of the same physical point are close under a chosen distance metric and can be matched across images.
In this topic
- 1SIFT Descriptor
- 2BRIEF Descriptor
- 3Lowe's Ratio Test
- 4Cross-Check Matching
SIFT Descriptor
Once SIFT has localised a keypoint at its characteristic scale and orientation, it must summarise the surrounding appearance so the same point matches from another view. The SIFT descriptor takes a 16×16 patch around the keypoint, splits it into a 4×4 grid of cells, and builds an 8-bin gradient-orientation histogram in each cell; concatenating them gives a 128-dimensional vector. Because the patch is first rotated to the keypoint's dominant gradient direction, the descriptor is rotation-invariant, and normalising the vector to unit length (with a cap at 0.2 and renormalisation) makes it robust to brightness and contrast changes. Gradients are Gaussian-weighted toward the centre so pixels near the edge of the patch matter less. The result is highly discriminative but relatively heavy — 128 floats per point — which motivates the compact binary descriptor next.
The SIFT descriptor divides a patch around the keypoint into a grid of cells, each containing an 8-bin orientation histogram. This gives a -dimensional vector. Gradients are weighted by a Gaussian window centered on the keypoint to reduce boundary effects. The descriptor is normalized to unit length, thresholded at 0.2, and renormalized — this bounds the influence of any single gradient and improves robustness to illumination changes. The descriptor is computed relative to the keypoint's dominant orientation (the peak of its orientation histogram), providing rotation invariance. Matching complexity for descriptors against is with brute force, or with kd-trees.
BRIEF Descriptor
SIFT's 128 floats are accurate but costly to store and slow to compare when thousands of features must be matched every frame. BRIEF (Binary Robust Independent Elementary Features) attacks both problems by encoding a patch as a binary string, typically 256 bits. It picks a fixed set of pixel pairs inside a smoothed patch and sets bit to 1 when and 0 otherwise, so each bit is one intensity comparison. Matching two such strings is a Hamming distance — an XOR followed by a popcount — which is roughly ten times faster than an L2 distance over SIFT floats and needs only 32 bytes of storage. The price is that BRIEF has no built-in rotation invariance, since its sampling pattern is fixed to the image axes; ORB, from the previous topic, fixes this by rotating the pattern with the keypoint.
BRIEF (Binary Robust Independent Elementary Features) computes a -bit string (typically ) by performing pairwise intensity comparisons: for pre-selected pixel pairs in a smoothed patch. The sampling pattern uses a Gaussian distribution where is the patch size. Each bit is a Bernoulli random variable with variance , so bits provide enough information for discrimination. Matching uses Hamming distance , computed with a single XOR + POPCOUNT instruction pair — this is faster than L2 distance on 128-float SIFT descriptors. The limitation is no rotation invariance — the fixed sampling pattern rotates with the image.
Lowe's Ratio Test
Even good descriptors produce false matches, especially in scenes with repetitive texture like brick walls or windows where many points look alike. Lowe's ratio test filters these by comparing a keypoint's two closest candidates: let be the distance to the nearest descriptor and to the second nearest, and accept the match only when , with around 0.7 to 0.8. The logic is that a genuinely distinctive match is much closer to its true partner than to any impostor, so a low ratio signals confidence, while a ratio near 1 means two candidates are almost equally close and the match is ambiguous. Lowe found this single test rejects about 90% of wrong matches while keeping about 95% of correct ones, making it one of the highest-leverage steps in the whole matching pipeline.
For a descriptor , let and be the distances to the nearest and second-nearest neighbors. The ratio measures match distinctiveness. Lowe recommended , which rejects 90% of incorrect matches while retaining 95% of correct ones. The intuition is probabilistic: correct matches have a clearly closest neighbor (), while incorrect matches in a cluttered scene have similar distances to multiple descriptors (). This follows from the distribution of nearest-neighbor distances in high-dimensional spaces — in 128D SIFT space, incorrect matches tend to have uniformly distributed distances, giving , while correct matches have .
Cross-Check Matching
The ratio test looks in one direction, but matching should be symmetric: if point in image one truly corresponds to in image two, then 's best match should be in return. Cross-check enforces exactly this mutual condition, accepting a pair only when is the nearest neighbour of and is the nearest neighbour of . This catches the many-to-one failures that a one-directional search misses — cases where several points in one image all claim the same partner in the other. It costs roughly twice the nearest-neighbour work but yields markedly higher precision, and it pairs well with the ratio test from the previous concept. Cross-check removes duplicate correspondences; a geometric verifier such as RANSAC then removes the remaining outliers by fitting a consistent transformation.
Cross-check matching requires mutual nearest neighbors: descriptor matches only if is the nearest neighbor of AND is the nearest neighbor of . If and , the match is accepted. This eliminates many-to-one matches that occur when multiple descriptors in image A are closest to the same descriptor in image B. The cost is doubled: for and descriptors. In practice, cross-check filtering retains about 50-70% of matches but with significantly higher precision. Combining cross-check with Lowe's ratio test provides a robust matching pipeline. For geometric verification, RANSAC further removes outliers by fitting a model (homography or fundamental matrix) with iterations where depends on the outlier ratio and is the minimal sample size.
Theory Exercise
Problem:
A SIFT keypoint in image 1 has descriptor d₁. In image 2, three candidates have distances: d_A=100, d_B=130, d_C=200. Using ratio threshold 0.75, which match (if any) is accepted?
Hints:
- Sort by distance to find nearest and second-nearest
- Compute ratio: best_distance / second_best_distance
- Accept if ratio < threshold
Feature detectors and descriptors, the earlier topics, find isolated points, but much of an image's meaning lives in its boundaries — the outlines where one region meets another. An edge is a place where intensity changes sharply, and such changes mark object silhouettes, surface creases, shadows, and occlusions. Detecting them reliably is a building block for contour extraction, segmentation, and the line-finding of the next topic. The difficulty is that real images are noisy, and the mathematics of finding sharp change — differentiation — amplifies exactly that noise, so a naive detector lights up everywhere. This topic develops edge detection from first principles. The image gradient defines what an edge is and why smoothing must come first, the Sobel operator gives a practical noise-tolerant gradient estimate, the Canny detector assembles smoothing, gradients, thinning, and hysteresis into the field's gold-standard pipeline, and the Laplacian of Gaussian finds edges as zero-crossings of the second derivative — a viewpoint that also connects directly to the blob detection SIFT relies on.
Definition
Edge detection is the task of locating pixels where image intensity changes abruptly, typically by computing gradient magnitude after smoothing, and marking as edges the points that are local maxima of that change, producing thin contours that trace region boundaries.
In this topic
- 1Image Gradient
- 2Sobel Operator
- 3Canny Edge Detector
- 4Laplacian of Gaussian (LoG)
Image Gradient
An edge is fundamentally a place of rapid intensity change, so the natural tool to find one is the derivative. The image gradient collects the rate of change in each direction; its magnitude measures edge strength and its direction points across the edge, perpendicular to it. In a discrete image the partials are approximated by finite differences between neighbouring pixels. The crucial catch is that differentiation is ill-posed: it magnifies high-frequency noise, so a raw gradient on a noisy image is unusable. The standard fix is to smooth first with a Gaussian, and because differentiation and convolution commute, we can convolve once with the derivative of a Gaussian — the insight every operator in this topic builds on.
The image gradient at pixel is . Discrete approximation uses finite differences: (central difference). The gradient magnitude measures the rate of intensity change, and the gradient direction is perpendicular to the edge. The gradient is a vector field on the image domain, and edges are the ridges of the gradient magnitude. Noise amplification is a key challenge: differentiation is an ill-posed inverse problem, and amplifies high-frequency noise. Pre-smoothing with a Gaussian (bandwidth ) regularizes this: — differentiation commutes with convolution, so we can convolve with the derivative of the Gaussian.
Sobel Operator
Computing a gradient with a bare two-pixel difference is exquisitely sensitive to noise, so in practice we want an estimate that smooths as it differentiates. The Sobel operator does this with two 3×3 kernels: detects vertical edges by differencing left and right columns, detects horizontal edges by differencing top and bottom rows. The weight of 2 on the centre row or column is what distinguishes Sobel from a plain difference — each kernel factors into a smoothing filter times a derivative filter, so it is separable and cheap, and the smoothing suppresses noise perpendicular to the derivative. That approximates a small Gaussian, tying Sobel directly to the derivative-of-Gaussian idea from the previous concept. The related Prewitt operator uses uniform weights and is slightly noisier; Scharr refines the weights for better rotational symmetry.
The Sobel operator approximates the gradient using kernels: and . Each kernel is separable: , factoring into a smoothing filter and a derivative filter . Separability reduces computation from to per pixel. The smoothing approximates a Gaussian with , providing noise reduction perpendicular to the derivative direction. Compared to the Prewitt operator ( smoothing), Sobel gives more weight to the center row, better approximating the true Gaussian-smoothed derivative. The Scharr operator further optimizes the rotation invariance of the gradient estimate.
Canny Edge Detector
The gradient and Sobel give edge strength, but a usable edge map needs thin, clean, connected contours — not a thick smear of high-gradient pixels. The Canny detector is the classic four-stage pipeline that delivers this. It first Gaussian-smooths to control noise, then computes gradient magnitude and direction (via Sobel), then applies non-maximum suppression to thin each ridge to a single-pixel width by keeping only local maxima along the gradient direction, and finally applies hysteresis thresholding with a high and a low threshold. Hysteresis is the clever part: pixels above the high threshold are certain edges, and weaker pixels between the two thresholds are kept only if they connect to a certain edge, which bridges gaps without admitting isolated noise. Canny proved this design is optimal for step edges under three criteria — good detection, accurate localisation, and single response — which is why it remains a default decades later.
Canny edge detection follows four steps: (1) Gaussian smoothing with (typically 1-2), (2) gradient magnitude and direction via Sobel, (3) non-maximum suppression (NMS) — thin edges to single-pixel width by keeping only pixels that are local maxima along the gradient direction, and (4) hysteresis thresholding with and . NMS compares each pixel's gradient magnitude against interpolated values of its two neighbors along ; if it is not the maximum, it is suppressed. Hysteresis tracks connected edge segments: pixels above are strong edges, those between and are weak edges kept only if connected to a strong edge. Canny proved this is optimal for step edges: it maximizes detection probability, minimizes localization error, and produces single-pixel-wide edges — the three criteria of optimal edge detection.
Laplacian of Gaussian (LoG)
The gradient-based methods above find edges as maxima of the first derivative, but there is an alternative worth knowing: edges are also where the second derivative crosses zero. The Laplacian of Gaussian combines both steps into one operator, , which first smooths with a Gaussian of scale and then takes the Laplacian, the sum of second spatial derivatives. Edges appear as the zero-crossings of , and because the operator is circularly symmetric it responds to edges of any orientation equally, unlike a single directional gradient. The scale selects how coarse the detected edges are. Crucially, the Difference of Gaussians approximates LoG — — which is precisely the cheap blob detector SIFT uses across scales, linking edge detection theory back to the feature detectors that opened this chapter.
The Laplacian of Gaussian is . It is a circularly symmetric second-derivative operator — edges appear as zero crossings of . The scale determines which edges are detected: larger detects coarser edges. LoG is the basis of the Marr-Hildreth edge detector. The Difference of Gaussians (DoG) approximates LoG: for close to 1. DoG is computationally cheaper since it only requires subtraction of two blurred images. SIFT uses DoG at multiple scales to build a scale-space representation where blob-like features are detected as extrema — connecting edge detection theory to feature detection.
Theory Exercise
Problem:
Apply the Sobel operators to the 3×3 patch: [[10, 10, 50], [10, 20, 80], [10, 10, 50]] Compute Gx, Gy, magnitude, and gradient direction.
Hints:
- Sobel Gx: [-1,0,1; -2,0,2; -1,0,1]
- Sobel Gy: [-1,-2,-1; 0,0,0; 1,2,1]
- Magnitude = sqrt(Gx² + Gy²)
- Direction = atan2(Gy, Gx)
Related Problems on PixelBank
Edge detection, the previous topic, gives a scatter of boundary pixels, but it does not tell us they form a straight lane marking, a circular coin, or the sides of a building — grouping edge pixels into the geometric shapes they belong to is a separate problem. It is hard because edges are broken by noise and occlusion, so the pixels of one line rarely form an unbroken chain, and outliers from other structures sit in between. The Hough Transform solves this with a beautifully indirect idea: instead of chaining pixels together in image space, let each edge pixel vote for every shape that could pass through it in a parameter space, and read off the shapes as the peaks where many votes coincide. Because voting is additive, missing pixels only lower a peak rather than break it, giving robustness to gaps and clutter. This topic develops the method from lines outward: the line parameterisation and its voting geometry, the accumulator array that tallies votes, the extension to circles, and the probabilistic variant that returns actual segments quickly.
Definition
The Hough Transform is a voting-based technique for detecting parametric shapes such as lines and circles, in which each edge pixel casts votes for all shape parameters consistent with it in an accumulator array, and shapes are recovered as the parameter cells that accumulate the most votes.
In this topic
- 1Hough Transform for Lines
- 2Accumulator Array
- 3Hough for Circles
- 4Probabilistic Hough Transform
Hough Transform for Lines
Detecting a line by testing every pair of edge pixels is hopeless when pixels are scattered and broken, so the Hough Transform reframes the problem in parameter space. It describes a line not by slope and intercept — which blow up for vertical lines — but by the normal form , where is the perpendicular distance from the origin and the angle of the line's normal, both bounded and well-behaved. A single image point satisfies this equation for a whole family of pairs, tracing a sinusoid in parameter space. The key fact is that collinear image points produce sinusoids that all cross at one — the parameters of their common line. Finding lines therefore becomes finding intersections in parameter space, which the accumulator of the next concept counts.
Each edge pixel defines a family of lines passing through it: in normal parameterization, where is the perpendicular distance from the origin and is the line angle. A single point traces a sinusoidal curve in parameter space (the Hough space). Collinear points produce sinusoids that intersect at a common — the parameters of the line they share. The resolution of (typically 1 degree = 180 bins) and (1 pixel = bins) determines accuracy and memory usage. The normal parameterization avoids the infinite slope problem of since and are both bounded.
Accumulator Array
The voting idea only becomes an algorithm once parameter space is made discrete and countable, which is the accumulator's job. It is a 2D array whose axes are quantised and bins, and it works exactly like a histogram of lines: for each edge pixel, increment every cell along that pixel's sinusoid . Where many pixels are collinear, their sinusoids pile votes into the same cell, so a strong line shows up as a bright peak that clears a threshold. The bin resolution is the central trade-off: fine bins localise lines precisely but cost memory and can split one line's votes across neighbours, while coarse bins are robust but imprecise. Because quantisation scatters votes slightly, the accumulator is often Gaussian-smoothed before peaks are extracted, so a true line is not missed by falling between two cells.
The accumulator is a 2D array in parameter space. For each edge pixel , we increment all cells along the sinusoid for . The complexity is — for bins and 1000 edge pixels, that is 180,000 increments. Peaks in correspond to lines in the image. Peak detection uses thresholding () followed by local maximum finding. The accumulator resolution trades off detection accuracy vs memory: with and pixel for a 640x480 image, has cells. Gaussian smoothing of before peak detection handles quantization noise from the discrete grid.
Hough for Circles
The same voting principle extends beyond lines to any shape with a small number of parameters, and circles are the classic next step. A circle is defined by , so its parameters are the centre and radius — three numbers, which means a 3D accumulator rather than 2D. That extra dimension is expensive: a full search over centre and radius has cost proportional to image area times the radius range. Two tricks tame it. If the radius is known in advance the problem collapses back to a 2D centre search, and more powerfully, the gradient direction at each edge pixel points along the line toward the circle's centre, so a pixel can vote along a single ray instead of a full circle of candidate centres. The generalised Hough transform pushes the idea further, detecting arbitrary shapes by storing edge-to-reference displacement vectors in a lookup table.
A circle has three parameters , requiring a 3D accumulator. For each edge pixel with gradient direction , the center lies along the gradient: . With known radius, this reduces to a 2D accumulator with votes. For unknown radius, the 3D accumulator has cells — prohibitively large. The practical approach iterates over a range of radii, or uses the gradient direction to vote along the normal line (1D voting per edge pixel, complexity ). The generalized Hough transform extends to arbitrary shapes by storing edge displacement vectors relative to a reference point in an R-table.
Probabilistic Hough Transform
The standard Hough transform votes with every edge pixel and returns infinite lines, which is both slow on dense edge maps and awkward when you actually want a line's endpoints. The probabilistic Hough transform speeds things up by voting with only a random subset of edge pixels, cutting the work roughly in proportion to the sample size while still finding well-supported lines with high probability — a line backed by many pixels is very likely to be hit by the sample. The progressive variant goes further: it accumulates votes incrementally, checks for a supported line after each vote, then traces that line in the image and removes its supporting pixels before continuing. This yields actual line segments with real endpoints rather than infinite lines, and typically runs several times faster than the full transform. The trade-off is that very short segments, backed by few pixels, may be missed by the random sampling.
The probabilistic Hough transform (PHT) randomly samples a subset of edge pixels from the total , reducing complexity from to . The probability of detecting a line supported by out of points with samples is . For and , the detection probability is . The Progressive Probabilistic Hough Transform (PPHT) goes further: it accumulates votes incrementally, checks for line segments after each vote, and removes detected points from the pool. This produces line segments (with endpoints) rather than infinite lines, and is typically 5-10x faster than standard Hough. The tradeoff is that very short line segments with few supporting pixels may be missed due to random sampling.
Theory Exercise
Problem:
Points A=(0,100) and B=(100,0) both lie on a line. What (ρ, θ) parameters describe this line?
Hints:
- Both points satisfy ρ = x·cos(θ) + y·sin(θ)
- Substitute both points to get two equations
- Solve for θ, then ρ