cameras
cameras
#
Camera geometry over Pose: the frame every reconstruction shares, and pixels as rays.
- World. Every pose lives in ARKit's right-handed, metric, y-up world, the one every session relocalized into a scene's world map shares.
- Pose. A
Poseis a camera-to-world transform in the OpenGL convention nerfstudio reads: the camera looks down its own-zwithyup, which is ARKit's camera transform as captured, socamera_to_worldis the quaternion's matrix beside the position,world_to_cameraits inverse, andpose_from_matrixthe way back from a solved matrix to aPose(matrix_to_quaternioninvertingquaternion_matrix). - Pixels. A pose's intrinsics are expressed at its reference size;
at_sizere-expresses them for a resized photograph,raysturns pixel centres into world-space directions, andto_worldplaces camera-space points.
at_size(pose, width, height)
#
pose with its intrinsics expressed at width×height.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in capturegraph-recipes/capturegraph_recipes/sfm/camera/cameras.py
camera_to_world(pose)
#
The 4×4 OpenGL camera-to-world matrix of pose.
Source code in capturegraph-recipes/capturegraph_recipes/sfm/camera/cameras.py
intrinsics(pose)
#
The pinhole intrinsics pose carries, or None when the device delivered none.
Source code in capturegraph-recipes/capturegraph_recipes/sfm/camera/cameras.py
matrix_to_quaternion(rotation)
#
The unit quaternion (w, x, y, z) of a rotation matrix; inverts quaternion_matrix.
Shepperd's method: the branch keyed on the largest diagonal term keeps the division well-conditioned for every proper rotation, the 180° cases included.
Source code in capturegraph-recipes/capturegraph_recipes/sfm/camera/cameras.py
pose_from_matrix(camera_to_world, like)
#
A Pose at the 4×4 camera_to_world with everything else taken from like.
The rotation and position come from the matrix; the intrinsics, tracking
state and time stay like's.
Source code in capturegraph-recipes/capturegraph_recipes/sfm/camera/cameras.py
position(pose)
#
The camera centre of pose in world coordinates.
quaternion_matrix(quaternion_w, quaternion_x, quaternion_y, quaternion_z)
#
The rotation matrix of a (possibly unnormalized) quaternion.
Source code in capturegraph-recipes/capturegraph_recipes/sfm/camera/cameras.py
rays(pose, columns, rows)
#
Unit world-space directions through the pixel centres (columns, rows) of pose.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in capturegraph-recipes/capturegraph_recipes/sfm/camera/cameras.py
to_world(pose, camera_points)
#
OpenCV camera-space points (x right, y down, z forward) in the world.
Source code in capturegraph-recipes/capturegraph_recipes/sfm/camera/cameras.py
world_to_camera(pose)
#
The 4×4 world-to-camera matrix of pose, the inverse of camera_to_world.