Program Listing for File visual-pipeline.h

Return to documentation for file (aslam_cv2/aslam_cv_pipeline/include/aslam/pipeline/visual-pipeline.h)

#ifndef VISUAL_PROCESSOR_H
#define VISUAL_PROCESSOR_H

#include <memory>

#include <opencv2/core/core.hpp>

#include <aslam/cameras/camera.h>
#include <aslam/common/macros.h>
#include <aslam/pipeline/undistorter.h>
#include <aslam/frames/visual-frame.h>

namespace aslam {
class VisualPipeline {
public:
  ASLAM_POINTER_TYPEDEFS(VisualPipeline);
  ASLAM_DISALLOW_EVIL_CONSTRUCTORS(VisualPipeline);

protected:
  VisualPipeline() : copy_images_(false) {};

public:
  VisualPipeline(const Camera::ConstPtr& input_camera, const Camera::ConstPtr& output_camera,
                 bool copy_images);

  VisualPipeline(std::unique_ptr<Undistorter>& preprocessing, bool copy_images);

  virtual ~VisualPipeline() {};

  VisualFrame::Ptr processImage(const cv::Mat& image, int64_t timestamp) const;

  const Camera& getInputCamera() const { CHECK(input_camera_); return *input_camera_; }

  const Camera& getOutputCamera() const { CHECK(output_camera_); return *output_camera_; }

  Camera::ConstPtr getInputCameraShared() const { return input_camera_; }

  Camera::ConstPtr getOutputCameraShared() const { return output_camera_; }

protected:
  virtual void processFrameImpl(const cv::Mat& image,
                                VisualFrame* frame) const = 0;

  const std::unique_ptr<Undistorter> preprocessing_;
  std::shared_ptr<const Camera> input_camera_;
  std::shared_ptr<const Camera> output_camera_;
  bool copy_images_;
};
}  // namespace aslam

#endif // VISUAL_PROCESSOR_H