How can I compare the SURF inliers?

조회 수: 1 (최근 30일)
Serena
Serena 2014년 6월 18일
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개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by