Documentation Center

  • Trial Software
  • Product Updates

extractFeatures

Extract interest point descriptors

Syntax

  • [features,validPoints] = extractFeatures(I,points) example
  • [features,validPoints] = extractFeatures(I,points,Name,Value) example

Description

example

[features,validPoints] = extractFeatures(I,points) returns extracted feature vectors, also known as descriptors, and their corresponding locations, from a binary or intensity image.

The function derives the descriptors from pixels surrounding an interest point. The pixels represent and match features specified by a single-point location. Each single-point specifies the center location of a neighborhood. The method you use for descriptor extraction depends on the class of the input points.

example

[features,validPoints] = extractFeatures(I,points,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

Code Generation Support:
Generates platform-dependent library: Yes, for BRISK, FREAK, and SURF methods only.
Compile-time constant input: Method
Supports MATLAB® Function block: Yes, for Block method only.
Code Generation Support, Usage Notes, and Limitations

Examples

expand all

Extract Corner Features from an Image.

Read the image.

  I = imread('cameraman.tif');

Find and extract corner features.

  corners = detectHarrisFeatures(I);
  [features, valid_corners] = extractFeatures(I, corners);

Display image.

  figure; imshow(I); hold on

Plot valid corner points.

  plot(valid_corners);

Extract SURF Features from an Image

Read image.

    I = imread('cameraman.tif');

Find and extract features.

    points = detectSURFFeatures(I);
    [features, valid_points] = extractFeatures(I, points);

Display and plot ten strongest SURF features.

    figure; imshow(I); hold on;
    plot(valid_points.selectStrongest(10),'showOrientation',true);

Extract MSER Features from an Image

Read image.

    I = imread('cameraman.tif');

Find features using MSER with SURF feature descriptor.

    regions = detectMSERFeatures(I);
    [features, valid_points] = extractFeatures(I, regions);

Display SURF features corresponding to the MSER ellipse centers.

    figure; imshow(I); hold on;
    plot(valid_points,'showOrientation',true);

Input Arguments

expand all

I — Input imagebinary image | M-by-N 2-D grayscale image

Input image, specified as either a binary or 2-D grayscale image.

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

points — Center location pointBRISKPoints object | cornerPoints object | SURFPoints object | MSERRegions object | M-by-2 matrix of [x,y] coordinates

Center location point of a square neighborhood, specified as either a BRISKPoints, SURFPoints, MSERRegions, or cornerPoints object, or an M-by-2 matrix of M number of [x y] coordinates. The function extracts descriptors from the square neighborhoods that are fully contained within the image boundary. Only square neighborhoods that are fully contained in the image determine the output valid points.

The table lists the descriptor extraction method for each class of points.

Class of PointsDescriptor Extraction Method
BRISKPointsBinary Robust Invariant Scalable Keypoints (BRISK)
SURFPoints objectSpeeded-Up Robust Features (SURF)
MSERRegions objectSpeeded-Up Robust Features (SURF)
cornerPointsFast Retina Keypoint (FREAK)
M-by-2 matrix of [x y] coordinatesSimple square neighborhood around [x y] point locations

Name-Value Pair 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 single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Method','Block' specifies the Block method for descriptor extraction.

'Method' — Descriptor extraction methodAuto (default) | 'BRISK' | 'FREAK' | 'SURF' | 'Block'

Descriptor extraction method, specified as a comma-separated pair consisting of 'Method' and the string 'FREAK', 'SURF', 'Block', or 'Auto'.

The table describes how the function implements the descriptor extraction methods.

MethodFeature Vector (Descriptor)
BRISKBinary Robust Invariant Scalable Keypoints (BRISK).
The function sets the Orientation property of the validPoints output object to the orientation of the extracted features, in radians.
FREAKFast Retina Keypoint (FREAK).
The function sets the Orientation property of the validPoints output object to the orientation of the extracted features, in radians.
SURFSpeeded-Up Robust Features (SURF).
The function sets the Orientation property of the validPoints output object to the orientation of the extracted features, in radians.

When you use an MSERRegions object with the SURF method, the Centroid property of the object extracts SURF descriptors. The Axes property of the object selects the scale of the SURF descriptors such that the circle representing the feature has an area proportional to the MSER ellipse area. The scale is calculated as 1/4*sqrt((majorAxes/2).*(minorAxes/2)) and saturated to 1.6, as required by the SURFPoints object.

BlockSimple square neighbhorhood.

The Block method extracts only the neighborhoods fully contained within the image boundary. Therefore, the output, validPoints, can contain fewer points than the input POINTS.

AutoThe function selects the Method, based on the class of the input points. The function implements:
The FREAK method for a cornerPoints input object.
The SURF method for a SURFPoints or MSERRegions input object.
The FREAK method for a BRISKPoints input object.

For an M-by-2 matrix of [x y] coordinates input, the function implements the Block method.

'BlockSize' — Block size11 (default) | odd integer scalar

Block size, specified as the comma-separated pair consisting of 'BlockSize' and an odd integer scalar. This value defines the local square neighborhood BlockSize-by-BlockSize, centered at each interest point. This option applies only when the function implements the Block method.

'SURFSize' — Length of feature vector64 (default) | 128

Length of the SURF feature vector (descriptor), specified as the comma-separated pair consisting of 'SURFSize' and the integer scalar 64 or 128. This option applies only when the function implements the SURF method. The larger SURFSize of 128 provides greater accuracy, but decreases the feature matching speed.

Output Arguments

expand all

features — Feature vectorsM-by-N matrix | binaryFeatures object

Feature vectors, returned as a binaryFeatures object or an M-by-N matrix of M feature vectors, also known as descriptors. Each descriptor is of length N.

validPoints — Valid pointsBRISKPoints object | cornerPoints object | SURFPoints object | MSERRegions object | M-by-2 matrix of [x,y] coordinates

Valid points associated with each output feature vector (descriptor) in features, returned in the same format as the input. Valid points can be a BRISKPoints, cornerPoints, SURFPoints, MSERRegions object, or an M-by-2 matrix of [x,y] coordinates.

The function extracts descriptors from a region around each interest point. If the region lies outside of the image, the function cannot compute a feature descriptor for that point. When the point of interest lies too close to the edge of the image, the function cannot compute the feature descriptor. In this case, the function ignores the point. The point is not included in the valid points output.

References

[1] G. Bradski and A. Kaehler, Learning OpenCV : Computer Vision with the OpenCV Library, O'Reilly, Sebastopol, CA, 2008.

[2] Herbert Bay, Andreas Ess, Tinne Tuytelaars, Luc Van Gool, SURF: Speeded Up Robust Features", Computer Vision and Image Understanding (CVIU), Vol. 110, No. 3, pp. 346--359, 2008

[3] Bay, Herbert, Andreas Ess, Tinne Tuytelaars, and Luc Van Gool, "SURF: Speeded Up Robust Features", Computer Vision and Image Understanding (CVIU), Vol. 110, No. 3, pp. 346--359, 2008.

[4] Alahi, Alexandre, Ortiz, Raphael, and Pierre Vandergheynst, "FREAK: Fast Retina Keypoint", IEEE Conference on Computer Vision and Pattern Recognition, 2012.

See Also

| | | | | | | | |

Was this topic helpful?