Program Listing for File vo-feature-tracking-pipeline.h

Return to documentation for file (algorithms/feature-tracking/include/feature-tracking/vo-feature-tracking-pipeline.h)

#ifndef FEATURE_TRACKING_VO_FEATURE_TRACKING_PIPELINE_H_
#define FEATURE_TRACKING_VO_FEATURE_TRACKING_PIPELINE_H_

#include <memory>
#include <vector>

#include <aslam/common/memory.h>
#include <aslam/common/thread-pool.h>
#include <aslam/frames/feature-track.h>
#include <aslam/tracker/feature-tracker.h>
#include <aslam/tracker/track-manager.h>
#include <maplab-common/macros.h>
#include <posegraph/unique-id.h>

#include "feature-tracking/feature-tracking-pipeline.h"

namespace feature_tracking {

class VOFeatureTrackingPipeline : public FeatureTrackingPipeline {
 public:
  MAPLAB_POINTER_TYPEDEFS(VOFeatureTrackingPipeline);
  MAPLAB_DISALLOW_EVIL_CONSTRUCTORS(VOFeatureTrackingPipeline);
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
  VOFeatureTrackingPipeline(
      const aslam::NCamera::ConstPtr& ncamera,
      const FeatureTrackingExtractorSettings& extractor_settings,
      const FeatureTrackingDetectorSettings& detector_settings);
  virtual ~VOFeatureTrackingPipeline();

  void trackFeaturesNFrame(
      const aslam::Quaternion& q_Bkp1_Bk, aslam::VisualNFrame* nframe_kp1,
      aslam::VisualNFrame* nframe_k,
      aslam::FrameToFrameMatchesList* inlier_matches_kp1_k,
      aslam::FrameToFrameMatchesList* outlier_matches_kp1_k);

 private:
  void initialize(const aslam::NCamera::ConstPtr& ncamera) override;
  void trackFeaturesNFrame(
      const aslam::Transformation& T_Bk_Bkp1, aslam::VisualNFrame* nframe_k,
      aslam::VisualNFrame* nframe_kp1) override;

  void trackFeaturesSingleCamera(
      const aslam::Quaternion& q_Bkp1_Bk, const size_t camera_idx,
      aslam::VisualFrame* frame_kp1, aslam::VisualFrame* frame_k,
      aslam::FrameToFrameMatches* inlier_matches_kp1_k,
      aslam::FrameToFrameMatches* outlier_matches_kp1_k);

  aslam::NCamera::ConstPtr ncamera_;
  std::vector<std::unique_ptr<FeatureDetectorExtractor>> detectors_extractors_;
  std::vector<std::unique_ptr<aslam::FeatureTracker>> trackers_;
  std::vector<std::unique_ptr<aslam::TrackManager>> track_managers_;
  std::unique_ptr<aslam::ThreadPool> thread_pool_;

  bool has_feature_extraction_been_performed_on_first_nframe_;

  const FeatureTrackingExtractorSettings extractor_settings_;
  const FeatureTrackingDetectorSettings detector_settings_;
};
}  // namespace feature_tracking

#endif  // FEATURE_TRACKING_VO_FEATURE_TRACKING_PIPELINE_H_