This header defines SphericalCamera, a pose-only camera whose measurements are unit bearing vectors, and EmptyCal, the zero-parameter calibration type used to satisfy generic camera interfaces.
import gtsam
import numpy as npEmptyCal¶
Spherical measurements have no focal length or principal point. EmptyCal is therefore a stateless placeholder; constructing it supplies generic code with a calibration object without adding optimization variables.
empty_calibration = gtsam.EmptyCal()
camera = gtsam.SphericalCamera(gtsam.Pose3(), empty_calibration)SphericalCamera projection¶
project(point) returns a Unit3 bearing in the camera frame. Unlike a pinhole camera, directions over the full sphere are valid and there is no image-plane cheirality boundary.
point = np.array([2.0, -1.0, 4.0])
bearing = camera.project(point)
print("bearing:", bearing.unitVector())
assert np.isclose(np.linalg.norm(bearing.unitVector()), 1.0)Backprojection and reprojection error¶
backproject(bearing, depth) follows a unit direction for the requested range. reprojectionError() returns a two-dimensional tangent-space error on the sphere.
depth = np.linalg.norm(point)
recovered = camera.backproject(bearing, depth)
np.testing.assert_allclose(recovered, point, atol=1e-9)
np.testing.assert_allclose(
camera.reprojectionError(point, bearing), np.zeros(2), atol=1e-12
)Pose operations¶
pose(), rotation(), and translation() expose camera geometry. retract() and localCoordinates() use a six-dimensional pose tangent, and Identity() creates an identity-pose camera.
Source¶
AI assistance caveat¶
AI was used to help draft this documentation, and inaccuracies could be present.