How can I compare the SURF inliers?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have to compare the inliers found through the SURF algorithm. For each inlier found in the frames of a video, if it is new I have to save the data and the frame where it was found otherwise I have to upgrade the data by adding the number of the frame where it was found again. My problem is when I do the for loop with if statement inside the loop: which parameters should I use to make sure that the program controls all inlier I found? This is my code:
for f=lastFrame+1:10 % For each frame of the video (First I tried with the first 10 frames)
fGray= rgb2gray(read(videoObj,f));
fFlip=flipdim (fGray,1);
if f>1 % For each previous frame of the video (I have to compare each frame with his previous)
f1Gray= rgb2gray(read(videoObj,(f-1)));
f1Flip=flipdim (f1Gray,1);
refPoints = detectSURFFeatures(fFlip);
refPrePoints = detectSURFFeatures(f1Flip);
[refFeatures, refPoints] = extractFeatures(fFlip, refPoints);
[refPreFeatures, refPrePoints] = extractFeatures(f1Flip, refPrePoints);
% matching
featPairs = matchFeatures(refFeatures, refPreFeatures);
matchedRefPrePoints = refPoints(featPairs(:, 1), :);
matchedRefPoints = refPrePoints(featPairs(:, 2), :);
%homography
[tform, inlierRefPoints, inlierRefPrePoints] = ...
estimateGeometricTransform(matchedRefPrePoints, matchedRefPoints, 'projective');
disp(inlierRefPoints); % to view data
% for each inlier found if it's new save it and reference frame, otherwise update frame data
for i = 2:numel(inlierRefPoints)
element = inlierRefPoints(i);
elementPre = inlierRefPrePoints(i);
mem = ismember (element, elementPre);
% disp (element)
% disp (elementPre)
if mem==1 % existing inlier
disp(['Inlier ',num2str(element) ,'exists in frame ', num2str(f)]);
else % new inlier
disp(['Inlier ',num2str(element) ,' is NEW']);
% Save data
end
end
end
end
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!