Main Content


Detect SURF features and return SURFPoints object



points = detectSURFFeatures(I) returns a SURFPoints object, points, containing information about SURF features detected in the 2-D grayscale 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;

Figure contains an axes object. The axes object contains 3 objects of type image, line.

Input Arguments

collapse all

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

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

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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 corners 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 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

Introduced in R2011b