Draw the strongest SIFT points on an image

Hello, I am working on an app, where I'm trying to visualize matching features of two images. Using showMatchedFeatures() I can get something like this:
However, if I use SIFT I would also like to visualize the strongest points on those two images. As stated in the documentation for visualizing strongest points on one image we can do something like this:
What would be the easiest way of implementing this alongside showMatchedFeatures() function. The simplest solution which comes to my mind would contain these steps: rewrite image matrieces by drawing these objects on them, before passing them to showMatchedFeatures() function -> pass these new images. Is there some way how to replace the plot() function from an example with somthing which will draw objects on our two original images?
Thank you.

Answers (1)

yes,sir,may be use it directly,such as
I1 = rgb2gray(imread('parkinglot_left.png'));
I2 = rgb2gray(imread('parkinglot_right.png'));
points1 = detectSIFTFeatures(I1);
points2 = detectSIFTFeatures(I2);
[f1, vpts1] = extractFeatures(I1, points1);
[f2, vpts2] = extractFeatures(I2, points2);
indexPairs = matchFeatures(f1, f2) ;
matchedPoints1 = vpts1(indexPairs(1:20, 1));
matchedPoints2 = vpts2(indexPairs(1:20, 2));
figure; ax = axes;
showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2,'montage','Parent',ax);
title(ax, 'Candidate point matches');
legend(ax, 'Matched points 1','Matched points 2');

2 Comments

You probably misunderstood me. I'm already using what you showed and what I need is to add the SIFT strongest points visalization onto those 2 images.
yes,sir,may be use insertObjectAnnotation to add points on image,such as
I1 = rgb2gray(imread('parkinglot_left.png'));
I2 = rgb2gray(imread('parkinglot_right.png'));
points1 = detectSIFTFeatures(I1);
points2 = detectSIFTFeatures(I2);
[f1, vpts1] = extractFeatures(I1, points1);
[f2, vpts2] = extractFeatures(I2, points2);
indexPairs = matchFeatures(f1, f2) ;
matchedPoints1 = vpts1(indexPairs(1:20, 1));
matchedPoints2 = vpts2(indexPairs(1:20, 2));
strongest1 = points1.selectStrongest(10)
strongest1 =
10×1 SIFTPoints array with properties: Scale: [10×1 single] Orientation: [10×1 single] Octave: [10×1 int32] Layer: [10×1 int32] Location: [10×2 single] Metric: [10×1 single] Count: 10
I1 = insertMarker(I1,strongest1.Location,'star','Size',12);
figure; imshow(I1,[]);
strongest2 = points2.selectStrongest(10)
strongest2 =
10×1 SIFTPoints array with properties: Scale: [10×1 single] Orientation: [10×1 single] Octave: [10×1 int32] Layer: [10×1 int32] Location: [10×2 single] Metric: [10×1 single] Count: 10
I2 = insertMarker(I2,strongest2.Location,'star','Size',12);
figure; imshow(I2,[]);
figure; ax = axes;
showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2,'montage','Parent',ax);
title(ax, 'Candidate point matches');
legend(ax, 'Matched points 1','Matched points 2');

Sign in to comment.

Products

Release

R2021b

Asked:

on 21 Feb 2022

Commented:

on 23 Feb 2022

Community Treasure Hunt

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

Start Hunting!