using this code, I am able to get the matched points, but I want to display the feature points without including the matched points. what modifications should the code need? Please someone help, Thank You.

function s=surfMatchesExample(str,name,st,en) matches_arr=[];
for num_images=st:en-1
disp(['Processing frame:',num2str(num_images),' and ',num2str(num_images+1)]);
path1=[str,'\',name,'_',num2str(num_images),'.bmp'];
path2=[str,'\',name,'_',num2str(num_images+1),'.bmp'];
I1=imread(path1);
I2=imread(path2);
img_arr1=rgb2gray(I1);
img_arr2=rgb2gray(I2);
f1= detectSURFFeatures(img_arr1);
f2= detectSURFFeatures(img_arr2);
h=length(f1);
g=length(f2);
disp(['No. of matching features in block ',num2str(num_images),'=',num2str(h)]);
disp(['No. of matching features in block ',num2str(num_images+1),'=',num2str(g)]);
[features1, validf1] = extractFeatures(img_arr1, f1);
[features2, validf2] = extractFeatures(img_arr2, f2);
%strongestPoints = validf1.selectStrongest(1000);
%no_of_features1=length(strongestPoints);
%disp(['No. of matching features in block ',num2str(num_images),'=',num2str(no_of_features1)]);
indexPairs = matchFeatures(features1, features2);
matchedIm1 = validf1(indexPairs(:,1),:);
matchedIm2 = validf2(indexPairs(:,2),:);
% matchedIm3 = validf2(indexPairs(:,3),:);
no_of_matchedPts=length(indexPairs);
%[features3, validf3] = extractFeatures(indexPairs,1);
% m3 = matchFeatures(features3, features2);
%m4=length(m3);
disp(['No. of matching features in block ',num2str(num_images),',',num2str(num_images+1),'=',num2str(no_of_matchedPts)]);
%disp(num2str(m4));
%[tform, inlierf1, inlierf2] = estimateGeometricTransform(matchedIm1, matchedIm2, 'affine');
figure;
showMatchedFeatures(I1,I2, matchedIm1, matchedIm2,'montage');
%g=length(h);
%disp(['No. of matching features in block ','=',g]);
end
end

 Accepted Answer

Do you mean that you want to display the detected points before matching? If so, than you can do the following:
f1= detectSURFFeatures(img_arr1);
figure
imshow(img_arr1);
plot(f1);

4 Comments

First of all Thank you for answering. But my question is that how can i get the unmatched points/features of the two frames? Please help
Thank you for clarifying. In that case, you should use logical indexing:
indexPairs = matchFeatures(features1, features2);
% create a logical index where all features are selected
unmatchedIdx1 = true(1, size(features1, 1));
% "de-select" the matched features
unmatchedIdx1(indexPairs(:, 1)) = false;
% get unmatched descriptors
unmatchedFeatures1 = features1(unmatchedIdx1, :);
You would need to do the same for features2. To get the point locations of the unmatched features, you would need to apply the logical index to f1 and f2.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!