Class sym::PolynomialCameraCal

template<typename ScalarType>
class PolynomialCameraCal

Autogenerated C++ implementation of symforce.cam.polynomial_camera_cal.PolynomialCameraCal.

Polynomial camera model in the style of OpenCV

Distortion is a multiplicative factor applied to the image plane coordinates in the camera frame. Mapping between distorted image plane coordinates and image coordinates is done using a standard linear model.

The distortion function is a 6th order even polynomial that is a function of the radius of the image plane coordinates::

r = (p_img[0] ** 2 + p_img[1] ** 2) ** 0.5
distorted_weight = 1 + c0 * r^2 + c1 * r^4 + c2 * r^6
uv = p_img * distorted_weight

Public Types

using Scalar = ScalarType
using Self = PolynomialCameraCal<Scalar>
using DataVec = Eigen::Matrix<Scalar, 8, 1>

Public Functions

inline PolynomialCameraCal(const Eigen::Matrix<Scalar, 2, 1> &focal_length, const Eigen::Matrix<Scalar, 2, 1> &principal_point, const Scalar critical_undistorted_radius, const Eigen::Matrix<Scalar, 3, 1> &distortion_coeffs)
inline explicit PolynomialCameraCal(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, 7> *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 PolynomialCameraCal<ToScalar> Cast() const
inline bool operator==(const PolynomialCameraCal &rhs) const
inline bool operator!=(const PolynomialCameraCal &rhs) const

Public Static Functions

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