Program Listing for File visual-nframe.h

Return to documentation for file (aslam_cv2/aslam_cv_frames/include/aslam/frames/visual-nframe.h)

#ifndef ASLAM_VISUAL_MULTI_FRAME_H
#define ASLAM_VISUAL_MULTI_FRAME_H

#include <memory>
#include <vector>

#include <aslam/common/macros.h>
#include <aslam/common/pose-types.h>
#include <aslam/common/unique-id.h>
#include <Eigen/Dense>

namespace aslam {
class Camera;
class NCamera;
class VisualFrame;

class VisualNFrame {
 public:
  ASLAM_POINTER_TYPEDEFS(VisualNFrame);
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW

  typedef std::vector<VisualNFrame::Ptr> PtrVector;
  typedef std::vector<VisualNFrame::ConstPtr> ConstPtrVector;

 protected:
  VisualNFrame() = default;

 public:
  VisualNFrame(const aslam::NFramesId& id, unsigned int num_frames);

  VisualNFrame(const aslam::NFramesId& id, std::shared_ptr<NCamera> ncameras);

  VisualNFrame(std::shared_ptr<NCamera> ncameras);

  virtual ~VisualNFrame() {}

  VisualNFrame(const VisualNFrame& other);
  VisualNFrame& operator=(const VisualNFrame& other);

  inline const aslam::NFramesId& getId() const { return id_; }

  inline void setId(const aslam::NFramesId& n_frames_id) { id_ = n_frames_id; }

  const NCamera& getNCamera() const;

  std::shared_ptr<NCamera> getNCameraShared();

  std::shared_ptr<const NCamera> getNCameraShared() const;

  void setNCameras(std::shared_ptr<NCamera> ncameras);

  bool isFrameSet(size_t frame_index) const;

  bool areAllFramesSet() const;

  bool isFrameValid(size_t frame_index) const;

  const VisualFrame& getFrame(size_t frame_index) const;

  std::shared_ptr<VisualFrame> getFrameShared(size_t frame_index);

  std::shared_ptr<const VisualFrame> getFrameShared(size_t frame_index) const;

  void setFrame(size_t frame_index, std::shared_ptr<VisualFrame> frame);

  void unSetFrame(size_t frame_index);

  size_t getNumFrames() const;

  size_t getNumCameras() const;

  const Transformation& get_T_C_B(size_t camera_index) const;

  const Camera& getCamera(size_t camera_index) const;

  const CameraId& getCameraId(size_t camera_index) const;

  bool hasCameraWithId(const CameraId& id) const;

  size_t getCameraIndex(const CameraId& id) const;

  int64_t getMinTimestampNanoseconds() const;
  int64_t getMaxTimestampNanoseconds() const;

  bool operator==(const VisualNFrame& other) const;

  bool compareWithoutCameraSystem(const VisualNFrame& other) const;

  static VisualNFrame::Ptr createEmptyTestVisualNFrame(
      const std::shared_ptr<NCamera>& ncamera, int64_t timestamp_nanoseconds);

  bool hasRawImagesInAllFrames() const;

  void releaseRawImagesOfAllFrames();

  void clearKeypointChannelsOfAllFrames();

 private:
  NFramesId id_;

  std::shared_ptr<NCamera> camera_rig_;

  std::vector<std::shared_ptr<VisualFrame>> frames_;
};

} // namespace aslam

#endif /* ASLAM_VISUAL_MULTI_FRAME_H */