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::KannalaBrandtModel Class Reference

#include <camera_models.h>

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

Public Member Functions

KannalaBrandtModeloperator= (const KannalaBrandtModel &)=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=100)
 
- Static Public Member Functions inherited from calico::sensors::CameraModel
static std::unique_ptr< CameraModelCreate (CameraIntrinsicsModel camera_model)
 

Static Public Attributes

static constexpr int kNumberOfParameters = 7
 
static constexpr CameraIntrinsicsModel kModelType = CameraIntrinsicsModel::kKannalaBrandt
 

Detailed Description

4-parameter Kannala-Brandt projection model as presented in OpenCV, also known as the "fisheye" model. This model assumes an isotropic pinhole model, i.e. \(f_x == f_y = f\).
Parameters are in the following order: \([f, c_x, c_y, k_1, k_2, k_3, k_4]\)

See https://docs.opencv.org/3.4/db/d58/group__calib3d__fisheye.html for more details.

Member Function Documentation

◆ ProjectPoint()

template<typename T >
static absl::StatusOr<Eigen::Vector2<T> > calico::sensors::KannalaBrandtModel::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 = \frac{\theta_d}{r}\mathbf{p}_m\\ \theta_d = \theta + k_1\theta^3 + k_2\theta^5 + k_3\theta^7 + k_4\theta^9\\ \theta = \arctan\left(r\right)\\ 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, k_3, k_4]\)

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::KannalaBrandtModel::UnprojectPixel ( const Eigen::VectorX< T > &  intrinsics,
const Eigen::Vector2< T > &  pixel,
int  max_iterations = 100 
)
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, k_3, k_4]\)

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 seems to require a significant number of Newton steps to properly converge. If you need faster code, it is recommended that you use OpenCV's implementation which is better conditioned.


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