miop.matrices_metadata¶
Classes
Computes camera intrinsics and extrinsics (rotation matrices) from metadata. |
- class miop.matrices_metadata.CameraMvmtFromMetadata[source]¶
Bases:
DAGNodeComputes camera intrinsics and extrinsics (rotation matrices) from metadata.
- rotation_matrices¶
Rotation matrices for each image in each face.
- Type:
list of list of np.ndarray
- camera_position¶
- List of dictionaries for each face containing:
‘rotations’: array of 3x3 rotation matrices (extrinsics)
‘intrinsics’: placeholder list for intrinsics (scaling and shear [ones, [1., 0.]])
- Type:
list of dict
- choose_axis(rot_z)[source]¶
Determines the tilt axis based on rotation in the (x, y) plane.
- Parameters:
rot_z (float) – Rotation angle in the (x, y) plane in radians.
- Returns:
A 3D unit vector representing the axis of rotation, one of: - [1., 0., 0.] (default: horizontal) - [-1., 0., 0.] (rot_z ≈ 180°) - [0., 1., 0.] (rot_z ≈ -90°) - [0., -1., 0.] (rot_z ≈ 90°)
- Return type:
list of float
- eval(img_collection)[source]¶
Computes camera extrinsics (rotation matrices) for each image in the image collection using the tilt angle and inferred tilt axis from metadata.
- Parameters:
img_collection (ImageCollection) – The collection of images with metadata from which to compute rotations.
- Returns:
- One dictionary per face, containing:
’rotations’: np.ndarray of shape (N, 3, 3), rotation matrices for N images
’intrinsics’: placeholder value ([ones, [1., 0.]])
- Return type:
list of dict
- get_rotation_matrix(angle, axis)[source]¶
Computes a 3x3 rotation matrix given an angle and rotation axis using Rodrigues’ formula.
- Parameters:
angle (float) – Rotation angle in radians.
axis (list of float) – 3D axis of rotation (e.g., [1., 0., 0.] for X-axis).
- Returns:
A 3x3 rotation matrix representing the rotation about the given axis.
- Return type:
np.ndarray