ds_msp.io¶
Camera I/O: Kalibr camchain YAML, MC-Calib, COLMAP, and nerfstudio interop. See Read/write Kalibr YAML for a task recipe.
ds_msp.io ¶
Camera I/O: Kalibr camchain YAML, COLMAP & nerfstudio interop.
colmap_to_model ¶
Reconstruct a DS-MSP camera model from a COLMAP (model, params) pair.
Source code in ds_msp/io/colmap.py
export_colmap ¶
export_colmap(out_dir: str, model, width: int, height: int, poses: ndarray, image_names: Sequence[str], points3d: Optional[ndarray] = None, point_colors: Optional[ndarray] = None, camera_id: int = 1) -> str
Write a COLMAP text sparse model from a DS-MSP calibration + poses + points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out_dir
|
str
|
Directory to write |
required |
model
|
CameraModel
|
DS-MSP camera model (KB / RadTan / pinhole; convert others to KB first). |
required |
width
|
int
|
Image resolution. |
required |
height
|
int
|
Image resolution. |
required |
poses
|
(N, 4, 4) array
|
|
required |
image_names
|
sequence of str
|
File names, one per pose. |
required |
points3d
|
(M, 3) array
|
Sparse point cloud (world frame). Many Gaussian-Splatting trainers require a sparse point cloud (they do not support random initialization). |
None
|
point_colors
|
(M, 3) uint8 array
|
Per-point RGB; defaults to mid-grey. |
None
|
camera_id
|
int
|
Single shared camera id (all images share one intrinsic model). |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
out_dir |
str
|
|
Source code in ds_msp/io/colmap.py
export_nerfstudio ¶
export_nerfstudio(path: str, model, width: int, height: int, poses: ndarray, image_names: Sequence[str]) -> str
Write a nerfstudio transforms.json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Output |
required |
model
|
CameraModel
|
DS-MSP camera model (KB / RadTan / pinhole; convert others to KB first). |
required |
width
|
int
|
Image resolution. |
required |
height
|
int
|
Image resolution. |
required |
poses
|
(N, 4, 4) array
|
|
required |
image_names
|
sequence of str
|
File names (used as |
required |
Returns:
| Name | Type | Description |
|---|---|---|
path |
str
|
|
Source code in ds_msp/io/nerfstudio.py
from_kalibr_cam ¶
Reconstruct a model from a Kalibr camN stanza (dict).
Source code in ds_msp/io/kalibr.py
load_kalibr ¶
Read a model from a Kalibr camchain YAML file.
Returns the model. Also accessible as (model, (width, height)) via
:func:load_kalibr_with_resolution.
Source code in ds_msp/io/kalibr.py
load_kalibr_extrinsics ¶
Load the stereo extrinsic T_cn_cnm1 (4x4) for cam from a camchain.
Kalibr stores, per camera, the transform from the previous camera into this
one (so cam1's T_cn_cnm1 is T_cam1_cam0). Raises KeyError if the
camera has no extrinsic block (e.g. the first camera in the chain).
Source code in ds_msp/io/kalibr.py
load_kalibr_with_resolution ¶
Read a model and its image resolution from a Kalibr camchain YAML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to a Kalibr camchain YAML file. |
required |
cam
|
str
|
Stanza key to read (e.g. |
"cam0"
|
Returns:
| Name | Type | Description |
|---|---|---|
model |
CameraModel
|
The reconstructed DS-MSP camera model (see the module docstring for the camera-model mapping table). |
resolution |
tuple of int
|
|
Source code in ds_msp/io/kalibr.py
model_to_colmap ¶
Map a DS-MSP camera model to a (colmap_model_name, params) pair.
Source code in ds_msp/io/colmap.py
read_colmap ¶
Read a COLMAP text sparse model.
Returns a dict with keys: cameras (list[ColmapCamera]), model (the
DS-MSP model for the first camera), images (list[ColmapImage], sorted by id),
poses ((N,4,4) T_cam_world), image_names (list[str]), points3d
((M,3) or None) and point_colors ((M,3) uint8 or None).
Source code in ds_msp/io/colmap.py
read_nerfstudio ¶
Read a nerfstudio transforms.json.
Returns a dict with model (DS-MSP model), width, height,
poses ((N,4,4) T_cam_world) and image_names.
Source code in ds_msp/io/nerfstudio.py
save_kalibr ¶
Write a single-camera Kalibr camchain YAML file.
Source code in ds_msp/io/kalibr.py
to_kalibr_cam ¶
Serialize a model into a Kalibr camN stanza (dict).