typing
Vector2Like
module-attribute
Type alias for 2D vector inputs.
Accepts
- Vector2 instances
- NumPy arrays with shape (2,)
- Lists: [x, y]
- Tuples: (x, y)
- Any sequence with 2 float elements
Vector3Like
module-attribute
Vector3Like = Union[
Vector3,
ArrayLike,
Sequence[float],
tuple[float, float, float],
list[float],
]
Type alias for 3D vector inputs.
Accepts
- Vector3 instances
- NumPy arrays with shape (3,)
- Lists: [x, y, z]
- Tuples: (x, y, z)
- Any sequence with 3 float elements
Vector6Like
module-attribute
Type alias for 6D vector inputs.
Accepts
- Vector6 instances
- NumPy arrays with shape (6,)
- Lists: [x1, x2, x3, x4, x5, x6]
- Tuples: (x1, x2, x3, x4, x5, x6)
- Any sequence with 6 float elements
QuaternionLike
module-attribute
QuaternionLike = Union[
Quaternion,
ArrayLike,
Sequence[float],
tuple[float, float, float, float],
list[float],
]
Type alias for quaternion inputs.
Accepts
- Quaternion instances
- NumPy arrays with shape (4,) - [w, x, y, z]
- Lists: [w, x, y, z]
- Tuples: (w, x, y, z)
- Any sequence with 4 float elements representing quaternion components
RotationLike
module-attribute
Type alias for general rotation inputs.
Accepts
- All QuaternionLike inputs
- 3x3 rotation matrices as NumPy arrays
- Any array-like object representing rotations
RoiLike
module-attribute
Type alias for Region of Interest (ROI) inputs.
Accepts
- Roi instances
- NumPy arrays with shape (4,)
- Lists: [xmin, ymin, xmax, ymax]
- Tuples: (xmin, ymin, xmax, ymax)
- Any sequence with 4 float elements representing bounding box coordinates
PointLike
module-attribute
Type alias for single point inputs (2D or 3D).
PointsLike
module-attribute
PointsLike = Union[
ArrayLike,
Sequence[Sequence[float]],
list[list[float]],
list[tuple[float, ...]],
]
Type alias for multiple points inputs.
Accepts
- NumPy arrays with shape (N, 2) or (N, 3)
- Lists of lists: [[x1, y1], [x2, y2], ...]
- Lists of tuples: [(x1, y1), (x2, y2), ...]
- Any nested sequence representing multiple points
Matrix3x3Like
module-attribute
Type alias for 3x3 matrix inputs.
Accepts
- NumPy arrays with shape (3, 3)
- Nested lists: [[a, b, c], [d, e, f], [g, h, i]]
- Any nested sequence representing a 3x3 matrix
Matrix4x4Like
module-attribute
Type alias for 4x4 matrix inputs.
Accepts
- NumPy arrays with shape (4, 4)
- Nested lists: 4x4 structure
- Any nested sequence representing a 4x4 matrix
TrajectoryLike
module-attribute
Type alias for trajectory inputs.
Accepts
- NumPy arrays with shape (M, T, D) where:
- M = number of modes
- T = number of timesteps
- D = spatial dimensions (usually 3)
- Triple-nested sequences with same structure
CameraIntrinsicLike
module-attribute
CameraIntrinsicLike = Union[
CameraIntrinsic,
ArrayLike,
Sequence[Sequence[float]],
list[list[float]],
]
Type alias for camera parameter inputs.
Accepts
- CameraIntrinsic instances
- NumPy arrays with shape (3, 3)
- Nested sequences of float values
CameraDistortionLike
module-attribute
Type alias for camera distortion inputs.
Accepts
- CameraDistortion instances
- NumPy arrays with shape (5,)
- Sequence of float values
ScalarLike
module-attribute
Type alias for scalar numeric inputs.
Accepts
- Python int or float
- NumPy scalar types
CameraIntrinsic
Bases: ndarray
A 3x3 camera intrinsic matrix with validation.
This class ensures that the input array is a 3x3 matrix and raises a ValueError if it is not. It can be constructed from a 3x3 array or 9 elements array.
Note that for non-camera, the array can be empty.
Examples:
>>> i = CameraIntrinsic(np.eye(3)) # OK
>>> i = CameraIntrinsic([1, 0, 0, 0, 1, 0, 0, 0, 1]) # OK
>>> i = CameraIntrinsic([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) # OK
>>> i = CameraIntrinsic([]) # OK
>>> i = CameraIntrinsic(np.eye(2)) # ValueError
>>> i = CameraIntrinsic([1, 0, 0, 0, 1, 0, 0, 0]) # ValueError
CameraDistortion
Bases: ndarray
A 1D array of length 5 representing the radial and tangential distortion coefficients.
This class represents the distortion parameters for a camera lens, typically following the Brown-Conrady (or similar) model.
The expected input is a 1D array of length 5, corresponding to the coefficients: - k1: Radial distortion coefficient. - k2: Radial distortion coefficient. - p1: Tangential distortion coefficient. - p2: Tangential distortion coefficient. - k3: Radial distortion coefficient.
Note that for non-camera, the array can be empty.
Examples:
>>> d = CameraDistortion([0, 0, 0, 0, 0]) # OK
>>> d = CameraDistortion([1, 2, 3, 4, 5]) # OK
>>> d = CameraDistortion([]) # OK
>>> d = CameraDistortion([1, 2, 3, 4]) # ValueError
>>> d = CameraDistortion([1, 2, 3, 4, 5, 6]) # ValueError
Matrix3x3
Bases: ndarray
A 3x3 matrix with validation.
Examples:
>>> matrix = Matrix3x3([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) # OK
>>> matrix = Matrix3x3(np.eye(3)) # OK
>>> matrix = Matrix3x3([[1, 2], [4, 5], [7, 8]]) # ValueError
>>> matrix = Matrix3x3(np.eye(2)) # ValueError
Matrix4x4
Bases: ndarray
A 4x4 matrix with validation.
Examples:
>>> matrix = Matrix4x4([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]) # OK
>>> matrix = Matrix4x4(np.eye(4)) # OK
>>> matrix = Matrix4x4([[1, 2], [4, 5], [7, 8]]) # ValueError
>>> matrix = Matrix4x4(np.eye(2)) # ValueError
Quaternion
Bases: Quaternion
A quaternion class that wraps the PyQuaternion class.
This wrapper exists to provide a consistent and explicit quaternion representation.
Examples:
>>> q = Quaternion(1, 2, 3, 4)
>>> q
Quaternion(1.000000, 2.000000, 3.000000, 4.000000)
>>> q.conjugate()
Quaternion(1.000000, -2.000000, -3.000000, -4.000000)
>>> q.norm()
5.477226
>>> q.inverse()
Quaternion(0.181818, -0.363636, -0.545455, -0.727273)
>>> q * q.inverse()
Quaternion(1.000000, 0.000000, 0.000000, 0.000000)
Roi
Bases: tuple
A 4-element tuple representing a region of interest (ROI).
This class ensures that the array always has the correct shape and value order. It can be constructed from any array-like object that can be converted to a tuple of length 4, or from individual numeric arguments.
Examples:
>>> roi = Roi(10, 20, 30, 40) # OK
>>> roi = Roi((10, 20, 30, 40)) # OK
>>> roi = Roi([10, 20, 30, 40]) # OK
>>> roi = Roi([10, 20]) # ValueError: ROI must be 4-elements
>>> roi = Roi([40, 30, 20, 10]) # ValueError: ROI must be xmin <= xmax && ymin <= ymax
offset
property
Return the xy offset from the image origin at the top left corner.
Vector2
Bases: BaseVector
A 2-element numpy array with validation.
This class ensures that the array always has exactly 2 elements. It can be constructed from any array-like object that can be converted to a 2-element numpy array.
Examples:
>>> v = Vector2([1, 2]) # OK
>>> v = Vector2(np.array([1, 2])) # OK
>>> v = Vector2(1, 2) # OK
>>> v = Vector2([1, 2, 3]) # ValueError
Vector3
Bases: BaseVector
A 3-element numpy array with validation.
This class ensures that the array always has exactly 3 elements. It can be constructed from any array-like object that can be converted to a 3-element numpy array.
Examples:
>>> v = Vector3([1, 2, 3]) # OK
>>> v = Vector3(np.array([1, 2, 3])) # OK
>>> v = Vector3(1, 2, 3) # OK
>>> v = Vector3([1, 2]) # ValueError
Vector6
Bases: BaseVector
A 6-element numpy array with validation.
This class ensures that the array always has exactly 6 elements. It can be constructed from any array-like object that can be converted to a 6-element numpy array.
Examples:
>>> v = Vector6([1, 2, 3, 4, 5, 6]) # OK
>>> v = Vector6(np.array([1, 2, 3, 4, 5, 6])) # OK
>>> v = Vector6(1, 2, 3, 4, 5, 6) # OK
>>> v = Vector6([1, 2]) # ValueError