Main Content


Detect SURF features



points = detectSURFFeatures(I) returns a SURFPoints object, points, containing information about SURF features detected in the 2-D grayscale or binary input image I. The detectSURFFeatures function implements the Speeded-Up Robust Features (SURF) algorithm to find blob features.

points = detectSURFFeatures(I,Name,Value) specifies options using one or more name-value arguments in addition to the input arguments in the previous syntax.


collapse all

Read image and detect interest points.

I = imread('cameraman.tif');
points = detectSURFFeatures(I);

Display locations of interest in image.

imshow(I); hold on;

Input Arguments

collapse all

Input image, specified as an M-by-N 2-D grayscale or binary image. The input image must be a real non-sparse value.

Data Types: single | double | int16 | uint8 | uint16 | logical

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: detectSURFFeatures(I,'MetricThreshold',100)

Strongest feature threshold, specified as a non-negative scalar. To return more blobs, decrease the value of this threshold.

Number of octaves, specified as an integer scalar, greater than or equal to 1. Increase this value to detect larger blobs. Recommended values are between 1 and 4.

Each octave spans a number of scales that are analyzed using varying size filters:

OctaveFilter Sizes
1 9-by-9, 15-by-15, 21-by-21, 27-by-27, ...
2 15-by-15, 27-by-27, 39-by-39, 51-by-51, ...
3 27-by-27, 51-by-51, 75-by-75, 99-by-99, ...

Higher octaves use larger filters and subsample the image data. Larger number of octaves result in finding larger size blobs. Set the NumOctaves parameter appropriately for the image size. For example, a 50-by-50 image require you to set the NumOctaves parameter, less than or equal to 2. The NumScaleLevels parameter controls the number of filters used per octave. At least three levels are required to analyze the data in a single octave.

Number of scale levels per octave to compute, specified as an integer scalar, greater than or equal to 3. Increase this number to detect more blobs at finer scale increments. Recommended values are between 3 and 6.

Rectangular region of interest, specified as a vector. The vector must be in the format [x y width height]. When you specify an ROI, the function detects blobs within the area at [x y] of size specified by [width height]. The [x y] elements specify the upper left corner of the region.

Output Arguments

collapse all

SURF features, returned as a SURFPoints object. This object contains information about SURF features detected in a grayscale or binary image.


[1] Bay, H., A. Ess, T. Tuytelaars, and L. Van Gool. “SURF:Speeded Up Robust Features.” Computer Vision and Image Understanding (CVIU).Vol. 110, No. 3, pp. 346–359, 2008.

Extended Capabilities

Version History

Introduced in R2011b