Why does extractFeatures on SIFTPoints returns duplicate points?

5 views (last 30 days)
I'm using detectSIFTFeatures followed by extractFeatures to get features points with their descriptor vectors:
points = detectSIFTFeatures(image);
[features, validPoints] = extractFeatures(image, points);
but became suspicious when the validPoints object contained more points than points. Looking closer, I found that validPoints was containing duplictaed points that differed only in orientation, and for each unique point, one of them had an orientation of 2*pi.

Accepted Answer

Labhansh Atriwal
Labhansh Atriwal on 12 Nov 2021
Hello @Tae Lim Kook, I want to let you know that it is okay to have validPoints more than points, in the following scenario:
points = detectSIFTFeatures(image);
[features, validPoints] = extractFeatures(image, points);
This is because SIFT algorithm allow multiple keypoints (with different orientation) at the same location. Refer to this paper on SIFT (page 13) - "...The highest peak in the histogram is detected, and then any other local peak that is within 80% of the highest peak is used to also create a keypoint with that orientation. Therefore, for locations with multiple peaks of similar magnitude, there will be multiple keypoints created at the same location and scale but different orientations...". The function detectSIFTFeatures only returns location of keypoints whereas extractFeatures returns all keypoints with orientation. I hope this is clear!
With all that said, you are not completely wrong by saying that there are some duplicate points in validPoints. Our initial investigation shows that there are still some duplicate points with orientation as 2*pi. This seems like a potential bug, and has been reported to the concerned team. I assure you that this will be looked into thoroughly. Meanwhile, please see the following workaround:
points = detectSIFTFeatures(image);
[features, validPoints] = extractFeatures(image, points);
%% Now remove duplicate points using one of the following ways:
% 1. Remove duplicates using tolerance
tol = 0.001;
validPoints(abs(validPoints.Orientation - 2*pi) < tol) = [];
% OR
% 2. Remove duplicates using single precision
validPoints(single(validPoints.Orientation) == single(2*pi)) = [];

More Answers (1)

yanqi liu
yanqi liu on 10 Nov 2021
sir,may be set some parameter,such as
detectSIFTFeatures(image,'NumScaleLevels',2);
  4 Comments
yanqi liu
yanqi liu on 12 Nov 2021
image = imread('cameraman.tif');
points = detectSIFTFeatures(image);
[features, validPoints] = extractFeatures(image, points);
points
points =
274×1 SIFTPoints array with properties: Scale: [274×1 single] Orientation: [274×1 single] Octave: [274×1 int32] Layer: [274×1 int32] Location: [274×2 single] Metric: [274×1 single] Count: 274
validPoints
validPoints =
612×1 SIFTPoints array with properties: Scale: [612×1 single] Orientation: [612×1 single] Octave: [612×1 int32] Layer: [612×1 int32] Location: [612×2 single] Metric: [612×1 single] Count: 612
pts = validPoints.Location;
[~,ia,ic] = unique(pts,'rows');
validPoints2 = validPoints(ia)
validPoints2 =
274×1 SIFTPoints array with properties: Scale: [274×1 single] Orientation: [274×1 single] Octave: [274×1 int32] Layer: [274×1 int32] Location: [274×2 single] Metric: [274×1 single] Count: 274

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!