Class sym::Camera

template<typename CameraCalType>
class Camera

Camera with a given camera calibration and an optionally specified image size (width, height).

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.

Subclassed by sym::PosedCamera< CameraCalType >

Public Types

using Scalar = typename CameraCalType::Scalar

Public Functions

inline Camera(const CameraCalType &calibration, const Eigen::Vector2i &image_size = Eigen::Vector2i(-1, -1))
inline Eigen::Matrix<Scalar, 2, 1> FocalLength() const
inline Eigen::Matrix<Scalar, 2, 1> PrincipalPoint() const
inline Eigen::Matrix<Scalar, 2, 1> PixelFromCameraPoint(const Eigen::Matrix<Scalar, 3, 1> &point, const Scalar epsilon, Scalar *const is_valid) const

Project a 3D point in the camera frame into 2D pixel coordinates.

Returns: pixel: (x, y) coordinate in pixels if valid is_valid: 1 if the operation is within bounds (including image_size bounds) else 0

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

Backproject a 2D pixel coordinate into a 3D ray in the camera frame.

NOTE: If image_size is specified and the given pixel is out of bounds, is_valid will be set to zero.

Args: normalize: Whether camera_ray will be normalized (False by default)

Returns: camera_ray: The ray in the camera frame is_valid: 1 if the operation is within bounds else 0

inline Scalar MaybeCheckInView(const Eigen::Matrix<Scalar, 2, 1> &pixel) const
inline CameraCalType Calibration() const
inline Eigen::Matrix<int, 2, 1> ImageSize() const

Public Static Functions

static inline Scalar InView(const Eigen::Matrix<Scalar, 2, 1> &pixel, const Eigen::Matrix<int, 2, 1> &image_size)

Returns 1.0 if the pixel coords are in bounds of the image, 0.0 otherwise.