Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Cal3DS2_Base

Cal3DS2_Base is an internal class. It contains the shared pinhole and Brown–Conrady distortion operations used by Cal3DS2 and Cal3Unified; applications normally construct one of those concrete calibration models.

Open In Colab
import gtsam
import numpy as np

Obtaining the base interface

Although Python exposes a default Cal3DS2_Base() constructor, its zero focal lengths do not describe a usable camera. A concrete Cal3DS2 instance supplies valid parameters while exposing all inherited base methods.

calibration = gtsam.Cal3DS2(
    800.0, 790.0, 0.0, 320.0, 240.0,
    1e-3, -1e-5, 2e-4, -1e-4,
)
print("is a Cal3DS2_Base:", isinstance(calibration, gtsam.Cal3DS2_Base))

Shared parameter access

The base provides fx(), fy(), skew(), px(), py(), k1(), k2(), p1(), p2(), k(), K(), inverse(), and vector(). Manifold dimension and retraction belong to the concrete derived model.

print("intrinsic matrix:")
print(calibration.K())
print("distortion [k1, k2, p1, p2]:", calibration.k())
print("complete vector:", calibration.vector())

Shared pixel mapping

uncalibrate() applies radial and tangential distortion followed by the intrinsic matrix. calibrate() numerically inverts that transformation.

normalized = np.array([0.15, -0.08])
pixel = calibration.uncalibrate(normalized)
recovered = calibration.calibrate(pixel)
print("pixel:", pixel)
np.testing.assert_allclose(recovered, normalized, atol=1e-7)

Source

Cal3DS2_Base.h

AI assistance caveat

AI was used to help draft this documentation, and inaccuracies could be present.