I have been analyzing codes from a certain project I found and there is one line of code that I do not understand and cannot find any answer on Google. What does .Metric do in line 28? Thank you!
%For Figure 1&2
I1 = rgb2gray(imread('sir1.jpg'));
I2 = rgb2gray(imread('sir2.jpg'));
subplot(2,1,1)
imshow(I1)
figure;
subplot(2,1,2);
imshow(I2)
%For Figure 3
figure;
points1 = detectHarrisFeatures(I1); plot(points1);
%For Figure 4
figure;
points2 = detectHarrisFeatures(I2); plot(points2);
[features1,valid_points1] = extractFeatures(I1,points1);
[features2,valid_points2] = extractFeatures(I2,points2);
indexPairs = matchFeatures(features1,features2);
matchedPoints1 = valid_points1(indexPairs(:,1),:);
matchedPoints2 = valid_points2(indexPairs(:,2),:);
%For Figure 5
figure;
showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2);
%For the Results
u=matchedPoints2.Metric-matchedPoints1.Metric;
if abs(u)<=0.04
disp("Matched");
else
disp("Not Matched");
end

 Accepted Answer

KSSV
KSSV on 19 May 2022
These lines:
matchedPoints1 = valid_points1(indexPairs(:,1),:);
matchedPoints2 = valid_points2(indexPairs(:,2),:);
The result is a structure. It has a fieldname Metric. This is what being used in the line 28.

More Answers (0)

Products

Release

R2021a

Asked:

on 19 May 2022

Answered:

on 19 May 2022

Community Treasure Hunt

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

Start Hunting!