Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Here I want to match the surf feature .I m storing the 1st surf feature in array and then matching the array with next frame features. But I am getting these errors. I am unable to resolve this problem. Please help, its part of my project.

1 Ansicht (letzte 30 Tage)
%% The Code %% function s=surfMatch(str,name,st,en) matches_arr=[]; total=0; unmatches_arr=[]; unmatch_feature=[];
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);
matchcount=0;
h=length(f1);
g=length(f2);
disp(['No. of features in frame ',num2str(num_images),'=',num2str(h)]);
disp(['No. of features in frame ',num2str(num_images+1),'=',num2str(g)]);
[features1, validf1] = extractFeatures(img_arr1, f1.selectStrongest(45));
[features2, validf2] = extractFeatures(img_arr2, f2.selectStrongest(45));
%strongestPoints = validf1.selectStrongest(1000);
%no_of_features1=length(strongestPoints);
unmatch_feature=horzcat(unmatch_feature,features1);
%disp(unmatch_feature);
%disp(['No. of matching features in block ',num2str(num_images),'=',num2str(no_of_features1)]);
indexPairs = matchFeatures(unmatch_feature, features2);
matchedIm1 = validf1(indexPairs(:,1),:);
matchedIm2 = validf2(indexPairs(:,2),:);
% matchedIm3 = validf2(indexPairs(:,3),:);
no_of_matchedPts=size(matchedIm1,1);
%[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)]);
matchcount=matchcount+no_of_matchedPts;
disp(['No. of overall matching features in block ','=',num2str(matchcount)]);
matches_arr=[matches_arr,no_of_matchedPts];
disp('No. of matching features of two consecutive frames stored in array ');
disp(matches_arr);
unmatchedIdx1 = true(1, size(features1, 1));
unmatchedIdx1(indexPairs(:, 1)) = false;
unmatchedFeatures1 = features1(unmatchedIdx1, :);
no_of_unmatched=length(unmatchedFeatures1);
disp(['The number of unmatched features of frame ',num2str(num_images),'=',num2str(no_of_unmatched)]);
unmatchedIdx2 = true(1, size(features2, 1));
unmatchedIdx2(indexPairs(:, 1)) = false;
unmatchedFeatures2 = features2(unmatchedIdx2, :);
no_of_unmatched1=length(unmatchedFeatures2);
disp(['The number of unmatched features of frame ',num2str(num_images+1),'=',num2str(no_of_unmatched1)]);
totalunmatchedpoints=no_of_unmatched1+no_of_unmatched;
disp(['No. of unmatching features in block ',num2str(num_images),',',num2str(num_images+1),'=',num2str(totalunmatchedpoints)]);
unmatches_arr=[unmatches_arr,totalunmatchedpoints];
disp('No. of unmatched features stored in array of the two consecutive frames');
disp(unmatches_arr);
% total=total+matchedIm1+unmatchedIdx1;
%t=length(total);
%disp((indexPairs));
%[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
The output,

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by