i am getting the maximum matched points with the feature pool. But with this i also want to get the frame no. which has the maximum matched points, please need help.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I designed this code.. with the help of this code i am getting the maximum no. of matched points with the feature pool, i have given an snapshot to help u guys to get the clear idea about what i am doing.But with this output i also want to get the Frame No. which has the maximum matched with the feature pool. the code
function s=surfMatchv2344(str,name,st,en) matches_arr=[]; total=0; unmatches_arr=[]; unmatch_feature=[]; un_feature=[]; un_arr=[]; path1=[str,'\',name,'_',num2str(st),'.bmp']; I1=imread(path1); img_arr1=rgb2gray(I1); f1= detectSURFFeatures(img_arr1); [features1, validf1] = extractFeatures(img_arr1, f1.selectStrongest(45)); % mycell = cell(21); %mycell=features1;
features_arr{1,:,:}=features1;
features_arr{1,:,:}
unmatch_feature=[unmatch_feature;features1];
for num_images=st+1:en
disp(['Processing frame:',num2str(num_images)]);
path2=[str,'\',name,'_',num2str(num_images),'.bmp'];
I2=imread(path2);
img_arr2=rgb2gray(I2);
f2= detectSURFFeatures(img_arr2);
matchcount=0;
[features2, validf2] = extractFeatures(img_arr2, f2.selectStrongest(45));
%mycell=features2;
%mycell
features_arr{num_images,:,:}=features2;
%features_arr{num_images,:,:}
indexPairs = matchFeatures(unmatch_feature, features2);
%indexPairs
%matchedIm1= validf1(indexPairs(:,1),:);
%matchedIm1
matchedIm2= validf2(indexPairs(:,2),:);
no_of_matchedPts=size(matchedIm2,1);
disp(['No. of matching features with frame ',num2str(num_images),'=',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);
unmatchedIdx2 = true(1, size(features2, 1));
unmatchedIdx2(any(indexPairs(:, 1)))=[];
unmatchedFeatures2 = features2(unmatchedIdx2, :);
no_of_unmatched1=size(unmatchedFeatures2,1);
unmatch_feature=[unmatch_feature;unmatchedFeatures2];
disp(size(unmatch_feature,1));
disp(['The number of unmatched features of frame ',num2str(num_images+1),'=',num2str(no_of_unmatched1)]);
%figure;
%showMatchedFeatures(I1,I2, matchedIm1, matchedIm2,'montage');
end
disp('NOW WE ARE MATCHING THE FEATURES OF THE FRAMES WITH THE FEATURE POINTS POOL');
for num_images=st:en
disp(['Processing frame:',num2str(num_images)]);
path2=[str,'\',name,'_',num2str(num_images),'.bmp'];
I2=imread(path2);
img_arr2=rgb2gray(I2);
f2= detectSURFFeatures(img_arr2);
matchcount=0;
[features2, validf2] = extractFeatures(img_arr2,f2);
features_arr{num_images,:,:}=features2;
indexPairs = matchFeatures(unmatch_feature,features_arr{num_images,:,:});
matchedIm2= validf2(indexPairs(:,2),:);
% indexPairs
no_of_matchedPts2=size(matchedIm2,1);
un_arr=[un_arr, no_of_matchedPts2];
disp(['No. of matching features with the feature points pool ',num2str(num_images),'=',num2str(no_of_matchedPts2)]);
%disp(sort(un_arr));
end
maximum_value=max(un_arr);
disp(['The maximum number of matched features of frame with feature pool = ',num2str(maximum_value)]);
if isequal(no_of_matchedPts2,maximum_value)
disp('Processing frame:');
%path2=[str,'\',name,'_',num2str(num_images),'.bmp'];
end
%features_arr{1,:,:}
%features_arr{num_images,:,:}
end
the o/p snapshot is attached
</matlabcentral/answers/uploaded_files/30794/11.png> here at the last line, i want to get the maximum matched feature, & also the number of the frame, containing it.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Computer Vision with Simulink finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!