Calico
A visual-inertial calibration library designed for rapid problem construction and debugging.
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
calico::sensors::OpenCv5Model Class Reference

#include <camera_models.h>

Inheritance diagram for calico::sensors::OpenCv5Model:
Inheritance graph
[legend]
Collaboration diagram for calico::sensors::OpenCv5Model:
Collaboration graph
[legend]

Public Member Functions

OpenCv5Modeloperator= (const OpenCv5Model &)=default
 
CameraIntrinsicsModel GetType () const final
 Getter for camera model type.
 
int NumberOfParameters () const final
 Getter for the number of parameters for this camera model.
 
- Public Member Functions inherited from calico::sensors::CameraModel
template<typename T >
absl::StatusOr< Eigen::Vector2< T > > ProjectPoint (const Eigen::VectorX< T > &intrinsics, const Eigen::Vector3< T > &point) const
 
template<typename T >
absl::StatusOr< Eigen::Vector3< T > > UnprojectPixel (const Eigen::VectorX< T > &intrinsics, const Eigen::Vector2< T > &pixel) const
 

Static Public Member Functions

template<typename T >
static absl::StatusOr< Eigen::Vector2< T > > ProjectPoint (const Eigen::VectorX< T > &intrinsics, const Eigen::Vector3< T > &point)
 
template<typename T >
static absl::StatusOr< Eigen::Vector3< T > > UnprojectPixel (const Eigen::VectorX< T > &intrinsics, const Eigen::Vector2< T > &pixel, int max_iterations=30)
 
- Static Public Member Functions inherited from calico::sensors::CameraModel
static std::unique_ptr< CameraModelCreate (CameraIntrinsicsModel camera_model)
 

Static Public Attributes

static constexpr int kNumberOfParameters = 8
 
static constexpr CameraIntrinsicsModel kModelType = CameraIntrinsicsModel::kOpenCv5
 

Detailed Description

5-parameter Brown-Conrady projection model as presented in OpenCV. This model assumes an isotropic pinhole model, i.e. \(fx == fy = f\).
Parameters are in the following order: \([f, c_x, c_y, k_1, k_2, p_1, p_2, k_3]\)

See the OpenCV documentations page for more details.

Member Function Documentation

◆ ProjectPoint()

template<typename T >
static absl::StatusOr<Eigen::Vector2<T> > calico::sensors::OpenCv5Model::ProjectPoint ( const Eigen::VectorX< T > &  intrinsics,
const Eigen::Vector3< T > &  point 
)
inlinestatic

Returns projection \(\mathbf{p}\), a 2-D pixel coordinate such that

\[ \mathbf{p} = \left[\begin{matrix}f&0\\0&f\end{matrix}\right]\mathbf{p}_d + \left[\begin{matrix}c_x\\c_y\end{matrix}\right]\\ \mathbf{p}_d = s\mathbf{p}_m + \left(2\mathbf{p}_m{\mathbf{p}_m}^T + r^2\mathbf{I}\right) \left[\begin{matrix}p_2\\p_1\end{matrix}\right]\\ s = 1 + k_1r^2 + k_2r^4 + k_3r^6\\ r^2 = {\mathbf{p}_m}^T\mathbf{p}_m\\ \mathbf{p}_m = \left[\begin{matrix}t_x / t_z\\t_y/t_z\end{matrix}\right]\\ \]

intrinsics is a vector of intrinsics parameters the following order: \([f, c_x, c_y, k_1, k_2, p_1, p_2, k_3]\)

point is the location of the feature resolved in the camera frame \(\mathbf{t}^s_{sx} = \left[\begin{matrix}t_x&t_y&t_z\end{matrix}\right]^T\).

◆ UnprojectPixel()

template<typename T >
static absl::StatusOr<Eigen::Vector3<T> > calico::sensors::OpenCv5Model::UnprojectPixel ( const Eigen::VectorX< T > &  intrinsics,
const Eigen::Vector2< T > &  pixel,
int  max_iterations = 30 
)
inlinestatic

Inverts the projection model \(\mathbf{P}\) to obtain the bearing vector \(\mathbf{p}_m\) of the pixel location \(\mathbf{p}\). No closed form solution is available, so we use Newton's method to invert the projection model.

intrinsics is a vector of intrinsics parameters the following order: \([f, c_x, c_y, k_1, k_2, p_1, p_2, k_3]\)

max_iterations specifies the maximum number of Newton steps to take. Optimization will stop automatically if the error is less than 1e-14.

Note: This implementation produces superior results for high distortions compared to OpenCV's implementation. If your application requires numerical precision, it is recommend that you use this one.


The documentation for this class was generated from the following file: