File posed_camera.h#

namespace sym
template<typename CameraCalType>
class PosedCamera : public sym::Camera<CameraCalType>
#include <posed_camera.h>

Camera with a given pose, camera calibration, and an optionally specified image size.

If the image size is specified, we use it to check whether pixels (either given or computed by projection of 3D points into the image frame) are in the image frame and thus valid/invalid.

Public Types

using Scalar = typename CameraCalType::Scalar

Public Functions

inline PosedCamera(const sym::Pose3<Scalar> &pose, const CameraCalType &calibration, const Eigen::Vector2i &image_size = Eigen::Vector2i(-1, -1))
inline Eigen::Matrix<Scalar, 2, 1> PixelFromGlobalPoint(const Eigen::Matrix<Scalar, 3, 1> &point, const Scalar epsilon, Scalar *const is_valid) const

Transforms the given point into the camera frame using the given camera pose, and then uses the given camera calibration to compute the resulted pixel coordinates of the projected point.

Args: point: Vector written in camera frame. epsilon: Small value intended to prevent division by 0.

Returns: pixel: UV coordinates in pixel units, assuming the point is in view is_valid: 1 if point is valid

inline Eigen::Matrix<Scalar, 3, 1> GlobalPointFromPixel(const Eigen::Matrix<Scalar, 2, 1> &pixel, Scalar range_to_point, const Scalar epsilon, Scalar *const is_valid) const

Computes a point written in the global frame along the ray passing through the center of the given pixel. The point is positioned at a given range along the ray.

Args: pixel: Vector in pixels in camera image. range_to_point: Distance of the returned point along the ray passing through pixel epsilon: Small value intended to prevent division by 0.

Returns: global_point: The point in the global frame. is_valid: 1 if point is valid

inline Eigen::Matrix<Scalar, 2, 1> WarpPixel(const Eigen::Matrix<Scalar, 2, 1> &pixel, Scalar inverse_range, const PosedCamera &target_cam, const Scalar epsilon, Scalar *const is_valid) const

Project a pixel in this camera into another camera.

Args: pixel: Pixel in the source camera inverse_range: Inverse distance along the ray to the global point target_cam: Camera to project global point into

Returns: pixel: Pixel in the target camera is_valid: 1 if given point is valid in source camera and target camera

inline const sym::Pose3<Scalar> &Pose() const

Private Members

sym::Pose3<Scalar> pose_#