Similariy matrics in SIFT or SURF

4 views (last 30 days)
Muhammad Awais Ali
Muhammad Awais Ali on 6 Mar 2022
Answered: Moksh on 13 Sep 2023
In LOCAL BINARY PATTERNS, the extracted vector have fixed row and col (1x59) so it is easy to compute the distance between two images using Euclidean. However,In SIFT the points are vary image to image. How can calculate the distance or dis(similarity) between Sift Features?

Answers (1)

Moksh
Moksh on 13 Sep 2023
Hi Awais,
I understand while extracting LBP features, vectors have fixed dimensions so Euclidean distance can be computed. But while extracting SURF features, the SURF points may vary from image to image which may cause the dimensions of features to vary.
You can use the “matchFeatures” function in MATLAB, which returns the indices of matching features for the two input feature sets. This function supports binary features as well as matrices as features.
Below is an example code for finding similar SURF features for two images:
% Defining two images
I1 = imread("cameraman.tif");
I2 = imresize(imrotate(I1, -20), 1.2); % Rotated cameraman image
% Extracting SURF features for both images
p1 = detectSURFFeatures(I1);
p2 = detectSURFFeatures(I2);
[f1, v1] = extractFeatures(I1, p1);
[f2, v2] = extractFeatures(I2, p2);
% Extracting indexes of matched features
indexPairs = matchFeatures(f1, f2);
MatchedPtsI1 = v1(indexPairs(:, 1)); % Matching points on I1
MatchedPtsI2 = v2(indexPairs(:, 2)); % Matching points on I2
Please refer to the below documentation for more information about the “matchFeatures”, “detectSURFFeatures” and “extractFeatures” functions respectively:
Hope this helps!
Best Regards,
Moksh Aggarwal

Community Treasure Hunt

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

Start Hunting!