Why does extractFeatures on SIFTPoints returns duplicate points?
5 views (last 30 days)
Show older comments
Tae Lim Kook
on 9 Nov 2021
Answered: Labhansh Atriwal
on 12 Nov 2021
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.
0 Comments
Accepted Answer
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)) = [];
0 Comments
More Answers (1)
yanqi liu
on 10 Nov 2021
sir,may be set some parameter,such as
detectSIFTFeatures(image,'NumScaleLevels',2);
4 Comments
yanqi liu
on 12 Nov 2021
image = imread('cameraman.tif');
points = detectSIFTFeatures(image);
[features, validPoints] = extractFeatures(image, points);
points
validPoints
pts = validPoints.Location;
[~,ia,ic] = unique(pts,'rows');
validPoints2 = validPoints(ia)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!