Skip to article frontmatterSkip to article content

Geometry

The geometry module provides the core classes for geometric concepts in GTSAM. This includes fundamental types such as Lie groups for rotations and poses, classes for 2D and 3D points, and various camera models for calibration. These representations are essential building blocks for many algorithms in the library, especially for inference and SLAM applications.

Core Types

Calibration Models

This section describes the classes representing different camera calibration models in GTSAM. These models handle the conversion between a camera’s 3D coordinate system and the 2D image plane, accounting for intrinsic parameters like focal length, principal point, and lens distortion.

The models are organized in a class hierarchy, with more specialized models inheriting from base classes.

Cal3

Cal3 is the common base class for all calibration models. It stores the five standard intrinsic parameters:

It provides the basic functionality but is not intended to be used directly in optimization, as it does not define a manifold structure itself.

Cal3_S2

Cal3_S2 is the most common 5-degree-of-freedom (DOF) calibration model and is designed for use in optimization. It represents the five parameters of Cal3 on a 5-dimensional manifold, allowing it to be used directly in factor graphs.

Cal3_S2Stereo

Cal3_S2Stereo extends Cal3_S2 for use with stereo cameras. It inherits the five standard intrinsic parameters and adds a sixth parameter, b, for the stereo baseline. This results in a 6-dimensional manifold for optimization.

Cal3f

Cal3f is a special, simplified model that assumes zero skew and a single focal length ff (i.e., fx=fyf_x = f_y). The principal point (u0,v0)(u_0, v_0) is also considered a fixed constant and is not optimized.

Because only the focal length ff is a variable, Cal3f has a manifold dimension of 1. This makes it extremely efficient for scenarios where you only need to calibrate for focal length, as the optimization space is much smaller.

Cal3Bundler

Cal3Bundler is designed to be compatible with Bundler, a structure-from-motion (SfM) system for unordered image collections written in C and C++. It inherits from Cal3f and adds two radial distortion coefficients, k1 and k2. This gives it a total of 3 degrees of freedom for optimization.

Cal3Fisheye

Cal3Fisheye is designed for cameras with fisheye lenses and implements the distortion model used by OpenCV. It inherits from the base Cal3 class and adds four fisheye-specific distortion coefficients: k1, k2, k3, and k4. This results in a 9-dimensional manifold for optimization.

Cal3DS2_Base, Cal3DS2, and Cal3Unified

This group of classes handles standard radial and tangential lens distortion, as specified by OpenCV.

Camera Models

This section describes the classes representing different camera models.

Geometric Relations and Utilities

These classes provide the building blocks for constructing factors and performing computations throughout the rest of GTSAM.