def process_matches(self, matches, f0, f1):
"""Process matches
Parameters
----------
matches : Tuple of float
(feature track id, feature index)
f0 : List of Features
Reference features
f1 : List of Features
Current features
"""
tracks_updated = {}
# Update or add feature track
for i in range(len(matches)):
f0_idx, f1_idx = matches[i]
feature0 = f0[f0_idx]
feature1 = f1[f1_idx]
if feature0.track_id is not None:
self.update_track(feature0.track_id, feature1)
self.debug("Update track [%d]" % feature0.track_id)
else:
self.add_track(feature0, feature1)
self.debug("Add track [%d]" % feature0.track_id)
tracks_updated[feature0.track_id] = 1
# Drop dead feature tracks
tracks_tracking = list(self.tracks_tracking)
for i in range(len(self.tracks_tracking)):
track_id = tracks_tracking[i]
if track_id not in tracks_updated:
self.remove_track(track_id, True)
self.debug("Tracking: " + str(self.tracks_tracking))
self.debug("Lost: " + str(self.tracks_lost))
self.debug("Buffer: " + str(self.tracks_buffer))
self.debug("")
评论列表
文章目录