Program Listing for File target-base.h

Return to documentation for file (aslam_cv2/aslam_cv_calibration/include/aslam/calibration/target-base.h)

#ifndef ASLAM_CALIBRATION_TARGET_BASE_H
#define ASLAM_CALIBRATION_TARGET_BASE_H

#include <utility>
#include <vector>

#include <aslam/common/macros.h>
#include <Eigen/Core>
#include <opencv2/core/core.hpp>

namespace aslam {
namespace calibration {
class TargetObservation;

class TargetBase {
 public:
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
  ASLAM_POINTER_TYPEDEFS(TargetBase);

 protected:
  TargetBase(size_t rows, size_t cols, const Eigen::Matrix3Xd& target_points);

 public:
  virtual ~TargetBase() {};

  const Eigen::Matrix3Xd& points() const;
  Eigen::Vector3d point(size_t point_idx) const;
  double* pointMutable(size_t point_idx);
  Eigen::Vector3d gridPoint(size_t row_idx, size_t col_idx) const;

  std::pair<size_t, size_t> pointToGridCoordinates(size_t point_idx) const;
  size_t gridCoordinatesToPoint(size_t row_idx, size_t col_idx) const;

  inline size_t rows() const { return rows_; };
  inline size_t cols() const { return cols_; };
  inline size_t size() const { return rows_ * cols_; };

  virtual double width() const;
  virtual double height() const;

 protected:
  const size_t rows_;
  const size_t cols_;

  Eigen::Matrix3Xd points_target_frame_;
}; //class TargetBase

class DetectorBase {
 public:
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
  ASLAM_POINTER_TYPEDEFS(DetectorBase);

 protected:
  DetectorBase() = default;

 public:
  virtual ~DetectorBase() {};

  virtual std::shared_ptr<TargetObservation> detectTargetInImage(const cv::Mat& image) const = 0;
}; //class DetectorBase

}  // namespace calibration
}  // namespace aslam

#endif  // ASLAM_CALIBRATION_TARGET_BASE_H