SURF

Also known as: Speeded-Up Robust Features

On this page 7

SURF, short for Speeded-Up Robust Features, is a local feature detector and descriptor in computer vision that finds distinctive image points and encodes their surroundings as compact vectors, so that the same physical point can be recognized across images taken at different scales, rotations and viewpoints. Introduced by Herbert Bay, Tinne Tuytelaars and Luc Van Gool in 2006, it was designed as a faster approximation of SIFT that keeps most of its robustness.

Within artificial intelligence, SURF belongs to the era of hand-crafted features that preceded learned convolutional descriptors. It remains relevant for image registration, panorama stitching, visual odometry and feature matching on hardware where deep networks are too heavy, and as a reference baseline in research.

How SURF detects keypoints with the Hessian matrix

SURF detects keypoints by searching for local maxima of the determinant of the Hessian matrix, which responds strongly to blob-like structures such as spots, corners of textured regions and small dark or bright patches. The Hessian is built from second-order Gaussian derivatives, and its determinant measures how sharply the intensity surface curves in two directions at once.

The central speed trick is the integral image. Each pixel of an integral image stores the sum of all intensities above and to the left of it, so the sum over any rectangle costs only four memory lookups, regardless of the rectangle size. SURF replaces the Gaussian second-derivative kernels with box filter approximations that can be evaluated through the integral image in constant time.

Instead of building an image pyramid by repeatedly smoothing and downsampling the image, SURF enlarges the filter while the image stays the same. Scale space is organized into octaves, each containing several filter sizes, starting at a 9 x 9 box filter that corresponds to a Gaussian with sigma of about 1.2. Candidate points are accepted after non-maximum suppression in a 3 x 3 x 3 neighborhood across position and scale, followed by interpolation for subpixel accuracy.

The table below summarizes the main stages of the SURF pipeline and the role each one plays.

StageOperationPurpose
Integral imageCumulative sum of pixel valuesConstant-time box filtering
Hessian detectionBox-filter approximation of second derivativesFind blob-like interest points
Scale-space searchGrowing filter sizes across octavesAchieve scale invariance
Orientation assignmentHaar wavelet responses in a circular regionAchieve rotation invariance
Descriptor extractionHaar responses in a 4 x 4 grid of subregionsEncode local appearance as a vector
Stages of the SURF pipeline

How the SURF descriptor encodes local appearance

The SURF descriptor summarizes the gradient structure around a keypoint with Haar wavelet responses, which are again computed cheaply from the integral image. First, a dominant orientation is estimated by summing horizontal and vertical wavelet responses inside a sliding angular window of 60 degrees within a circle of radius 6s, where s is the detected scale.

A square window of size 20s is then aligned with that orientation and split into a 4 x 4 grid of subregions. For each subregion, SURF records four sums: the sum of dx, the sum of dy, the sum of absolute dx and the sum of absolute dy. Sixteen subregions with four values each give the standard 64-dimensional descriptor, which is normalized to unit length for invariance to contrast changes.

Several variants trade speed for distinctiveness or drop invariances that a given application does not need.

VariantDescriptor lengthTypical use
SURF-6464 valuesDefault balance of speed and accuracy
SURF-128128 valuesHigher distinctiveness, split sums by gradient sign
U-SURF (upright)64 valuesCameras that stay roughly level, faster matching
GPU SURF64 or 128 valuesReal-time processing of video streams
Common SURF variants

The sign of the Laplacian, the trace of the Hessian, is stored with each keypoint at no extra cost. During matching, only keypoints with the same contrast polarity are compared, which shortens the search and removes many false candidates.

SURF compared with SIFT, ORB and learned features

SURF sits between the accurate but slower SIFT and the very fast binary ORB detector. Benchmarks report SURF as roughly three times faster than SIFT on a CPU, with comparable repeatability under scale and rotation changes, while SIFT usually remains more stable under strong viewpoint and illumination changes.

The following comparison places SURF among the feature methods most often used for keypoint detection and matching.

MethodDescriptor typeRelative speedMain strength
SIFT128 floating-point valuesSlowHigh robustness to viewpoint and scale
SURF64 floating-point valuesMediumGood robustness at lower cost
ORB256-bit binary stringVery fastReal-time use on embedded devices
Learned featuresNeural network embeddingFast on GPUBest accuracy on hard benchmarks
SURF and related feature methods

Learned detectors and descriptors such as SuperPoint, together with learned matchers, generally outperform SURF in difficult conditions like night-to-day matching. SURF still wins where no training data, no GPU or full interpretability are required.

Matching SURF features in practice

Practical SURF matching compares descriptors with the Euclidean distance and keeps only reliable pairs. The standard filter is the ratio test: a match is accepted when the distance to the nearest neighbor is clearly smaller than the distance to the second nearest, with thresholds typically between 0.6 and 0.8.

For large descriptor sets, exact search is replaced with approximate nearest neighbor structures such as k-d trees. Surviving matches are then verified geometrically with RANSAC, which estimates a homography or fundamental matrix and rejects outliers that do not fit the model.

The main parameters below control how many keypoints SURF returns and how they behave.

ParameterTypical valueEffect
Hessian threshold300 to 500Higher values return fewer, stronger keypoints
Number of octaves3 to 4More octaves detect larger structures
Layers per octave2 to 3Finer sampling of scale
Extended flagOff or onSwitches between 64 and 128 values
Upright flagOff or onSkips orientation for speed
Key SURF parameters

Limitations and licensing of SURF

SURF has clear technical limits. The box-filter approximation reduces accuracy at certain rotations, the method copes poorly with strong perspective distortion and large illumination changes, and repetitive textures such as facades or tiled floors create ambiguous matches.

  • Weak on textureless surfaces: plain walls and sky produce almost no keypoints.
  • Not affine invariant: viewpoint changes beyond about 30 to 40 degrees degrade matching sharply.
  • Floating-point descriptors: memory use and matching cost are higher than with binary descriptors.
  • Patent history: SURF was patented, so OpenCV moved it to the nonfree contrib module.

Because of that patent status, many open-source projects replaced SURF with ORB, AKAZE or SIFT, whose patent expired in 2020. Teams should check the license terms of their library build before shipping SURF in a commercial product.

Understanding it simply

SURF finds special spots in a picture. These spots are easy to find again, even in another photo. A photo may be closer, farther away or turned. SURF still recognizes the same spots.

For each spot, SURF writes a short list of numbers. The list describes how light and dark areas change nearby. It works like a fingerprint for a small patch. To match two photos, a computer compares these fingerprints. Similar fingerprints most likely show the same point. SURF was built to do this much faster than older methods.

Applied in practice

A small drone mapping team surveys a 40-hectare field and captures about 600 overlapping photos at 70 percent overlap. The onboard computer has no GPU, so the team uses upright SURF with a Hessian threshold of 400, because the camera stays nearly level during flight.

Each image yields around 1,500 keypoints. Neighboring images are matched with the ratio test at 0.7, and RANSAC estimates a homography for each pair. The stitching software then aligns all images into a single orthomosaic. Processing finishes in under an hour on a laptop, and alignment errors stay below two pixels in most areas. Problems appear only over a uniform patch of bare soil, where too few keypoints are found and the team adds ground control points to fix the gap.