Main Content

SIFTPoints

Object for storing SIFT interest points

Since R2021b

Description

The SIFTPoints object enables you to pass data between the detectSIFTFeatures and extractFeatures functions. You can also use it to manipulate and plot the data returned by these functions. You can use the object to fill interest points interactively.

Creation

Description

example

points = SIFTPoints(location) constructs a SIFTPoints object from an M-by-2 matrix of [x y] point coordinates in location.

points = SIFTPoints(location,Name=Value) sets properties using one or more name-value arguments. For example, SIFTPoints(Metric=0.0)

Input Arguments

expand all

Point coordinates, specified as an M-by-2 matrix of [x y] point coordinates. M is the number of points.

Properties

expand all

Scale at which the interest points are detected, specified as a value greater than 0.

Strength of the detected feature, specified as a value in the range [0 1]. The SIFT algorithm uses the contrast threshold to determine strong features.

Orientation of the detected feature, specified as an angle, in radians. The angle is measured counterclockwise from the X-axis with the origin specified by the location input. Do not set this property manually. Instead, use the call to extractFeatures to fill in this value. The extractFeatures function modifies the default value of 0.0.The Orientation is mainly useful for visualization purposes.

Index of the Gaussian pyramid octave layer that the keypoint is extracted from, specified as an integer. An octave is a collection of difference-of-Gaussian pyramid layers, and is used for scale-space.

Layer within the octave from which the keypoint was extracted, specified as an integer.

Object Functions

plotPlot points
isemptyDetermine if points object is empty
lengthNumber of stored points
selectStrongestSelect points with strongest metrics
sizeReturn size of points object
selectUniformSelect uniformly distributed subset of point features

Examples

collapse all

Read an image.

I = imread("cameraman.tif");

Detect SIFT features in the image.

points = detectSIFTFeatures(I)
points = 
  245x1 SIFTPoints array with properties:

          Scale: [245x1 single]
    Orientation: [245x1 single]
         Octave: [245x1 int32]
          Layer: [245x1 int32]
       Location: [245x2 single]
         Metric: [245x1 single]
          Count: 245

Display the location and scale of the 10 strongest points in the image.

strongest = points.selectStrongest(10);
imshow(I)
hold on
plot(strongest) 

Display the [x y] coordinates for the selected points.

strongest.Location
ans = 10x2 single matrix

  183.0139  205.4790
  112.5054  206.6145
  135.2954  125.0968
  101.1768  173.8070
  131.3702  113.8461
  167.1152   77.5036
  110.9539  155.9264
  135.0020   92.3701
  112.1106  173.5276
  156.8862   77.8692

Read an image into the workspace.

I = imread("cameraman.tif");

Detect SIFT features in the image.

points = detectSIFTFeatures(I);

Display the last 5 detected points.

imshow(I)
hold on
plot(points(end-4:end))

Tips

  • Although SIFTPoints may hold many points, it is a scalar object. Therefore, numel(SIFTPoints) always returns 1. This value may differ from length(SIFTPoints), which returns the true number of points held by the object.

  • Properties can be specified as a scalar or a vector whose length matches the number of coordinates in location.

References

[1] Lowe, David G.. "Distinctive Image Features from Scale-Invariant Keypoints." Int. J. Comput. Vision 60 , no. 2 (2004): 91--110.

Extended Capabilities

Version History

Introduced in R2021b