Class sym::DoubleSphereCameraCal

template<typename ScalarType>
class DoubleSphereCameraCal

Autogenerated C++ implementation of symforce.cam.double_sphere_camera_cal.DoubleSphereCameraCal.

Camera model where a point is consecutively projected onto two unit spheres with centers shifted by xi, then projected into the image plane using the pinhole model shifted by alpha / (1 - alpha).

There are important differences here from the derivation in the paper and in other open-source packages with double sphere models; see notebooks/double_sphere_derivation.ipynb for more information.

The storage for this class is:

[ fx fy cx cy xi alpha ]

TODO(aaron): Create double_sphere_derivation.ipynb

TODO(aaron): Probably want to check that values and derivatives are correct (or at least sane) on the valid side of the is_valid boundary

Reference: https://vision.in.tum.de/research/vslam/double-sphere

Public Types

using Scalar = ScalarType
using Self = DoubleSphereCameraCal<Scalar>
using DataVec = Eigen::Matrix<Scalar, 6, 1>

Public Functions

inline DoubleSphereCameraCal(const Eigen::Matrix<Scalar, 2, 1> &focal_length, const Eigen::Matrix<Scalar, 2, 1> &principal_point, const Scalar xi, const Scalar alpha)
inline explicit DoubleSphereCameraCal(const DataVec &data, bool normalize = true)

Construct from data vec

Parameters:

normalize – Project to the manifold on construction. This ensures numerical stability as this constructor is called after each codegen operation. Constructing from a normalized vector may be faster, e.g. with FromStorage.

inline const DataVec &Data() const
inline void ToStorage(Scalar *const vec) const
Eigen::Matrix<Scalar, 2, 1> FocalLength() const

Return the focal length.

Eigen::Matrix<Scalar, 2, 1> PrincipalPoint() const

Return the principal point.

Eigen::Matrix<Scalar, 2, 1> PixelFromCameraPoint(const Eigen::Matrix<Scalar, 3, 1> &point, const Scalar epsilon, Scalar *const is_valid = nullptr) 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 else 0

Eigen::Matrix<Scalar, 2, 1> PixelFromCameraPointWithJacobians(const Eigen::Matrix<Scalar, 3, 1> &point, const Scalar epsilon, Scalar *const is_valid = nullptr, Eigen::Matrix<Scalar, 2, 6> *const pixel_D_cal = nullptr, Eigen::Matrix<Scalar, 2, 3> *const pixel_D_point = nullptr) 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 else 0 pixel_D_cal: Derivative of pixel with respect to intrinsic calibration parameters pixel_D_point: Derivative of pixel with respect to point

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

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

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

Eigen::Matrix<Scalar, 3, 1> CameraRayFromPixelWithJacobians(const Eigen::Matrix<Scalar, 2, 1> &pixel, const Scalar epsilon, Scalar *const is_valid = nullptr, Eigen::Matrix<Scalar, 3, 6> *const point_D_cal = nullptr, Eigen::Matrix<Scalar, 3, 2> *const point_D_pixel = nullptr) const

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

Returns: camera_ray: The ray in the camera frame (NOT normalized) is_valid: 1 if the operation is within bounds else 0 point_D_cal: Derivative of point with respect to intrinsic calibration parameters point_D_pixel: Derivation of point with respect to pixel

inline bool IsApprox(const Self &b, const Scalar tol) const
template<typename ToScalar>
inline DoubleSphereCameraCal<ToScalar> Cast() const
inline bool operator==(const DoubleSphereCameraCal &rhs) const
inline bool operator!=(const DoubleSphereCameraCal &rhs) const

Public Static Functions

static inline constexpr int32_t StorageDim()
static inline DoubleSphereCameraCal FromStorage(const Scalar *const vec)