-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatchKeypts.m
More file actions
21 lines (16 loc) · 883 Bytes
/
Copy pathmatchKeypts.m
File metadata and controls
21 lines (16 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function [matched_keypts0, matched_keypts1] = matchKeypts(img0, img1, valid_keypts0, ~, pms)
% This function tracks the keypoints in img0 to img1 by using KLT. The
% point tracker is initialized with the locations of the valid keypoints in
% img0. It returns the locations of the tracked points and the reliability
% of track for each point.
tracker = vision.PointTracker('NumPyramidLevels', pms.numpyramid_levels, 'BlockSize', pms.block_size, ...
'MaxBidirectionalError', pms.max_bidirecterr, 'MaxIterations', pms.max_iterations);
% initialize the point tracker
initialize(tracker, valid_keypts0.Location, img0);
[keypts1_locs, validity] = tracker(img1);
% store the locations of keypoints
valid_keypts1 = keypts1_locs;
% keep the valid keypoints
matched_keypts0 = valid_keypts0.Location(validity, :);
matched_keypts1 = valid_keypts1(validity, :);
end