Class FeatureTrackExtractor

Class Documentation

class vio_common::FeatureTrackExtractor

This class can be used to extract feature tracks from a stream of VisualFrames that contain the TrackIDs channel.

Constructors and operators.


FeatureTrackExtractor() = delete
explicit FeatureTrackExtractor(const std::shared_ptr<const aslam::NCamera> &camera_rig)

Default constructor with a default value for min_track_length of 2 and max track length of 1000.

Note that a realistic max track length is necessary because memory is pre-allocated according to that length.

FeatureTrackExtractor(const std::shared_ptr<const aslam::NCamera> &camera_rig, size_t max_track_length)

Constructor with a default value for min_track_length of 2.

FeatureTrackExtractor(const std::shared_ptr<const aslam::NCamera> &camera_rig, size_t max_track_length, size_t min_track_length)
inline ~FeatureTrackExtractor()

Track extraction methods.

size_t extractFromNFrameStream(const std::shared_ptr<const aslam::VisualNFrame> &nframe, aslam::FeatureTracksList *all_tracks)

Extracts feature tracks from a VisualNFrame stream for all cameras.

  • nframe[in] Current VisualNFrame to extract the tracks from.

  • all_tracks[out] Vector of tracks that ended in the previous frame. Tracks reaching max track length are cut and also returned such that their last referenced frame is the previous frame. The outer vector corresponds to the cameras in the rig.


Number of finished tracks over all cameras.

void extractFromNFrameStream(const aslam::VisualNFrame::ConstPtr &nframe, aslam::FeatureTracksList *tracks_opportunistic_terminated, aslam::FeatureTracksList *tracks_persistent_new, std::vector<aslam::ContinuedFeatureTracks> *tracks_persistent_continued, std::vector<std::unordered_set<int>> *tracks_persistent_terminated)

Extracts feature tracks from a VisualNFrame stream for all cameras.

This method overload returns the tracks separated for each camera.

  • nframe[in] Current nframe containing the tracks.

  • tracks_opportunistic_terminated[out] Terminated opportunistic feature tracks. These tracks terminated before reaching the max. length and are no longer tracked.

  • tracks_persistent_new[out] New persistent feature tracks. These tracks reached the max. length and are returned for triangulation and processing. Further observations of this track are returned as tracks_persistent_continued messages.

  • tracks_persistent_continued[out] Continued persistent feature tracks.

  • tracks_persistent_terminated[out] Terminated persistent feature tracks.

void extractFromNFrameStream(const aslam::VisualNFrame::ConstPtr &nframe, aslam::FeatureTracks *tracks_opportunistic_terminated, aslam::FeatureTracks *tracks_persistent_new, aslam::ContinuedFeatureTracks *tracks_persistent_continued, std::unordered_set<int> *tracks_persistent_terminated)

Same as extractFromFrameStream but the tracks of all cameras are joined into one list.

size_t abortAndReturnOpportunisticTracks(aslam::FeatureTracksList *tracks)

Abort and return all opportunistic tracks.

Returns the total number of tracks over all cameras.

void abortAndReturnNLongestOpportunisticTracks(size_t num_tracks_to_abort, size_t min_track_length, aslam::FeatureTracks *aborted_tracks)

Abort and return the N longest opportunistic tracks.

void abortPersistentTracksByTrackId(const std::unordered_set<int> &track_ids_to_abort)

Abort a list of persistent features specified by the TrackId.

All cameras are searched for TrackId matches.

size_t getNumOpportunisticTracks(size_t camera_idx) const

Get the current number of opportunistic feature tracks.

size_t getNumPersistentTracks(size_t camera_idx) const

Get the current number of persistent feature tracks.

inline void setMaxTrackLength(size_t max_track_length)

Set the max.

track length. Already active opportunistic tracks over this length will be returned in the next call to extractFromNFrameStream.

void reset()

Reset all internal states.

static size_t extractBatch(const std::vector<std::shared_ptr<const aslam::VisualNFrame>> &nframes, aslam::FeatureTracksList *all_tracks)

Extracts all feature tracks given a list of nframes.

  • nframes[in] List of VisualNFrame to extract the tracks from.

  • all_tracks[out] All feature tracks.


Number of finished tracks over all cameras.

static inline size_t extractBatch(const std::vector<std::shared_ptr<aslam::VisualNFrame>> &nframes, aslam::FeatureTracksList *all_tracks)

Forwarder for NonConstPtr vectors.

Public Members