Class sym::SphericalCameraCal#

template<typename ScalarType>
class SphericalCameraCal#

Autogenerated C++ implementation of symforce.cam.spherical_camera_cal.SphericalCameraCal.

Kannala-Brandt camera model, where radial distortion is modeled relative to the 3D angle theta off the optical axis as opposed to radius within the image plane (i.e. ATANCamera)

I.e. the radius in the image plane as a function of the angle theta from the camera z-axis is assumed to be given by::

r(theta) = theta + d[0] * theta^3 + d[1] * theta^5 + d[2] * theta^7 + d[3] * theta^9

This model also includes two tangential coefficients, implemented similar to the Brown-Conrady model. For details, see the Fisheye62 model from Project Aria: https://facebookresearch.github.io/projectaria_tools/docs/tech_insights/camera_intrinsic_models

With no tangential coefficients, this model is over-parameterized in that we may scale all the distortion coefficients by a constant, and the focal length by the inverse of that constant. To fix this issue, we peg the first coefficient at 1. So while the distortion dimension is ‘4’, the actual total number of coeffs is 5.

Additionally, the storage for this class includes the critical theta, the maximum angle from the optical axis where projection is invertible; although the critical theta is a function of the other parameters, this function requires polynomial root finding, so it should be computed externally at runtime and set to the computed value.

Paper::

A generic camera model and calibration method for conventional, wide-angle, and fish-eye
lenses Kannala, Juho; Brandt, Sami S. PAMI 2006

This is the simpler “P9” model without any non-radially-symmetric distortion params, but also includes two tangential distortion params similar to the Brown-Conrady model.

The storage for this class is:

[ fx fy cx cy critical_theta d0 d1 d2 d3 p0 p1]

Public Types

using Scalar = ScalarType#
using Self = SphericalCameraCal<Scalar>#
using DataVec = Eigen::Matrix<Scalar, 11, 1>#

Public Functions

inline SphericalCameraCal(const Eigen::Matrix<Scalar, 2, 1> &focal_length, const Eigen::Matrix<Scalar, 2, 1> &principal_point, const Scalar critical_theta, const Eigen::Matrix<Scalar, 6, 1> &distortion_coeffs)#
inline explicit SphericalCameraCal(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, 10> *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

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

Public Static Functions

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