Program Listing for File camera-factory.h

Return to documentation for file (aslam_cv2/aslam_cv_cameras/include/aslam/cameras/camera-factory.h)

#ifndef ASLAM_CAMERAS_CAMERA_FACTORY_H_
#define ASLAM_CAMERAS_CAMERA_FACTORY_H_

#include <memory>
#include <type_traits>

#include <Eigen/Dense>
#include <yaml-cpp/yaml.h>

#include <aslam/cameras/camera.h>
#include <aslam/cameras/distortion.h>
#include <aslam/common/unique-id.h>
#include <aslam/common/yaml-serialization.h>

namespace aslam {

template <typename CameraType, typename DistortionType>
typename CameraType::Ptr createCamera(const Eigen::VectorXd& intrinsics,
                                      uint32_t image_width, uint32_t image_height,
                                      const Eigen::VectorXd& distortion_parameters) {
  typename aslam::Distortion::UniquePtr distortion(new DistortionType(distortion_parameters));
  typename CameraType::Ptr camera(
      new CameraType(intrinsics, image_width, image_height, distortion));
  aslam::CameraId id;
  generateId(&id);
  camera->setId(id);
  return camera;
}

template <typename CameraType>
typename CameraType::Ptr createCamera(const Eigen::VectorXd& intrinsics,
                                      uint32_t image_width, uint32_t image_height) {
  typename CameraType::Ptr camera(new CameraType(intrinsics, image_width, image_height));
  aslam::CameraId id;
  generateId(&id);
  camera->setId(id);
  return camera;
}

Camera::Ptr createCamera(aslam::CameraId id, const Eigen::VectorXd& intrinsics,
                         uint32_t image_width, uint32_t image_height,
                         const Eigen::VectorXd& distortion_parameters,
                         Camera::Type camera_type,
                         Distortion::Type distortion_type);

Camera::Ptr createCamera(const YAML::Node& yaml_node);

}  // namespace aslam

#endif  // ASLAM_CAMERAS_CAMERA_FACTORY_H_