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.

StereoPoint2

StereoPoint2 stores a rectified stereo measurement (uL, uR, v): horizontal coordinates in the left and right images plus their shared vertical coordinate.

Open In Colab
import gtsam
import numpy as np

Initialization

Construct from three scalars or a three-vector. Identity() returns the zero measurement.

measurement = gtsam.StereoPoint2(340.0, 315.0, 205.0)
from_vector = gtsam.StereoPoint2(np.array([340.0, 315.0, 205.0]))
print("same measurement:", measurement.equals(from_vector, 1e-12))

Components and disparity

uL(), uR(), and v() expose the components, while vector() returns them in constructor order. The horizontal disparity uL - uR is inversely related to depth for a rectified stereo pair.

disparity = measurement.uL() - measurement.uR()
print("measurement vector:", measurement.vector())
print("disparity:", disparity)
assert disparity > 0.0

Use with StereoCamera

StereoCamera.project() produces this type, and StereoCamera.backproject() consumes it. Keeping the shared v coordinate explicit encodes the rectified-image assumption.

The value type does not enforce measurement validity. In normal rectified geometry, positive finite depth produces positive disparity; zero disparity corresponds to a point at infinity, and negative disparity usually indicates a mismatched observation or inconsistent camera convention.

Source

StereoPoint2.h

AI assistance caveat

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