acerobotics2025 commited on
Commit
a3e20d8
·
verified ·
1 Parent(s): 4f64801

Upload Calibration

Browse files
Room-scale/calibration/Calibration-Exported.mcal ADDED
Binary file (73.7 kB). View file
 
Room-scale/calibration/README.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Camera Calibration
2
+
3
+ Calibration files for the capture rig used in all released takes:
4
+
5
+ - **8 static ZED cameras** (`zed_cam0`–`zed_cam7`, 1920×1080)
6
+ - **4 egocentric fisheye cameras** on the head-mounted "Homie" rig
7
+ (`front_left`, `front_right`, `back_left`, `back_right`, 1088×1280)
8
+ - **OptiTrack Motive** motion-capture system (rigid-body / skeleton tracking)
9
+
10
+ **World frame:** everything shares the OptiTrack Motive world frame — **Y-up,
11
+ millimeters** — identical to the Motive CSV exports (`raw/mocap_raw/*.csv`,
12
+ `raw/object_mocap_raw/rb_*.csv`) in each take. Camera axes follow the OpenCV
13
+ convention (+Z forward, +X right, +Y down).
14
+
15
+ **Take layout:** released takes use `raw/{egocentric_raw,exocentric_raw,mocap_raw,object_mocap_raw}`
16
+ (formerly `homie/`, `zed/`, `motive/`, `objects/`), `timeline/` (formerly
17
+ `preprocess/` + the top-level sync CSVs), `motions/` (formerly `viz/`), and
18
+ `videos_and_annotations/` (formerly `videos/`, plus the projection renders).
19
+ Raw frame dumps (`homie/frames`, `zed/frames`) and `.svo2` recordings are not
20
+ shipped.
21
+
22
+ ## Files
23
+
24
+ | File | Content |
25
+ |------|---------|
26
+ | `zed_intrinsics.json` | Per-ZED intrinsics: `K` (3×3), `dist` (8-coeff OpenCV rational model `[k1,k2,p1,p2,k3,k4,k5,k6]`), image size. Keys `"0"`–`"7"` = `zed_cam0`–`zed_cam7`. |
27
+ | `zed_poses_0622.json` | Per-ZED extrinsics `T_c2w` (4×4 camera→world, mm) plus a copy of K/dist. Calibrated 2026-06-22 with an AprilTag board tracked by OptiTrack; valid for every released take. `meta` documents the method and residuals. |
28
+ | `homie-camchain.yaml` | Homie fisheye intrinsics + cam-to-cam chain (kalibr format): pinhole + `equidistant` (Kannala–Brandt, use `cv2.fisheye`), `intrinsics = [fx, fy, cx, cy]`. **Note: `T_cn_cnm1` translations here are in meters** (kalibr convention), unlike the mm world frame. |
29
+ | `homie_rig_calib.json` | Hand–eye result `T_homie_cam` (4×4 camera→rig, mm) mapping each fisheye camera into the frame of the OptiTrack rigid body named "Homie", plus per-camera residual time delays `delays_s` (~2 ms). |
30
+ | `Calibration-Exported.mcal` | OptiTrack Motive calibration export (poses of the 12 IR mocap cameras, same world frame). Only needed if you want the mocap cameras themselves. |
31
+
32
+ ### Camera name mappings
33
+
34
+ ZED index ↔ device serial (index = ascending serial order;
35
+ `videos_and_annotations/zed_camN.mp4` in each take):
36
+
37
+ | index | serial | | index | serial |
38
+ |-------|-----------|-|-------|-----------|
39
+ | cam0 | 302899467 | | cam4 | 306087165 |
40
+ | cam1 | 303008978 | | cam5 | 306714077 |
41
+ | cam2 | 304203361 | | cam6 | 306854655 |
42
+ | cam3 | 304866636 | | cam7 | 308314642 |
43
+
44
+ Homie camera ↔ camchain key ↔ raw frame folder (capture-pipeline
45
+ `homie/frames/<folder>`, not shipped in released takes):
46
+
47
+ | camera | camchain key | raw frame folder |
48
+ |--------------|--------|------|
49
+ | front_left | cam0 | cam2 |
50
+ | front_right | cam1 | cam1 |
51
+ | back_left | cam2 | cam0 |
52
+ | back_right | cam3 | cam3 |
53
+
54
+ (The released `videos_and_annotations/homie_*.mp4` are already named by
55
+ camera, so the folder mapping only matters if you work with raw frame dumps.
56
+ Note these mp4s are the **rectified 1024×1024 pinhole** views, not the raw
57
+ 1088×1280 fisheye frames — see `--rectified` below.)
58
+
59
+ ## How to use
60
+
61
+ ### Project a 3D point into a ZED video
62
+
63
+ ```python
64
+ import json, numpy as np, cv2
65
+
66
+ cams = json.load(open("zed_poses_0622.json"))["cameras"]
67
+ c = cams["3"] # zed_cam3
68
+ T_w2c = np.linalg.inv(np.array(c["T_c2w"])) # world -> camera
69
+ K, dist = np.array(c["K"]), np.array(c["dist"])
70
+
71
+ p_w = np.array([x_mm, y_mm, z_mm, 1.0]) # OptiTrack world point, mm
72
+ p_c = (T_w2c @ p_w)[:3]
73
+ uv, _ = cv2.projectPoints(p_c.reshape(1, 1, 3), np.zeros(3), np.zeros(3), K, dist)
74
+ ```
75
+
76
+ Any point from `raw/object_mocap_raw/rb_*.csv`, the Motive take CSV
77
+ (`raw/mocap_raw/*.csv`), or the SMPL-X track can be projected this way — they
78
+ are all already in the same world frame.
79
+
80
+ ### Per-frame Homie (egocentric) camera poses
81
+
82
+ The rig moves, so its camera poses are per-frame:
83
+ `T_world_cam(t) = T_world_homie(t + delay_cam) @ T_homie_cam`, where
84
+ `T_world_homie(t)` is the "Homie" rigid-body pose from the take's Motive CSV
85
+ and `T_homie_cam` comes from `homie_rig_calib.json`.
86
+
87
+ `scripts/homie_extrinsics.py` does all of this (rigid-body interpolation,
88
+ per-camera delays, fisheye intrinsics) and writes one JSON with intrinsics +
89
+ per-frame `world→cam` matrices. Point it at a take directory:
90
+
91
+ ```bash
92
+ python scripts/homie_extrinsics.py /mnt/sync_data/<take> --out <take>/homie_poses.json
93
+ ```
94
+
95
+ It reads the take's `raw/mocap_raw/*.csv` and `timeline/sync_timeline.csv`
96
+ (present in every take; the frame list comes from the sync CSV, so the
97
+ missing raw frame dumps don't matter). Intrinsics come from the take's own
98
+ `calibration_cache` when present, else the shared `homie-camchain.yaml`.
99
+ The old capture-pipeline invocation (`<take>/homie/frames`) still works.
100
+
101
+ By default the output matches the **raw fisheye** frames — project with
102
+ `cv2.fisheye.projectPoints` and the `equidistant` coefficients. To work with
103
+ the released `videos_and_annotations/homie_*.mp4` (rectified 1024×1024
104
+ pinhole views) pass `--rectified`; video frame `i` corresponds to
105
+ `sync_timeline.csv` record `i`.
106
+
107
+ ### Full-scene sanity check (Rerun viewer)
108
+
109
+ `scripts/visualize/` is a self-contained viewer that loads every calibration
110
+ file in this folder, places all camera frustums in the OptiTrack world, and
111
+ overlays the synchronized RGB streams and the SMPL-X body mesh:
112
+
113
+ ```bash
114
+ cd scripts/visualize
115
+ pip install -r requirements.txt
116
+ python visualize_case.py <take-dir> --no-room-assets
117
+ ```
118
+
119
+ (`--no-room-assets` because the optional room-mesh assets are not shipped
120
+ here; see its `README.md` for viewing over SSH and more options.)
121
+
122
+ ## Synchronization
123
+
124
+ Streams inside a take are already synchronized: `videos_and_annotations/*.mp4`
125
+ are the synced exports, `timeline/sync_timeline.csv` maps frame indices across
126
+ ZED / Homie / OptiTrack (Homie↔OptiTrack clock offset already folded in;
127
+ `timeline/homie_time_offset.json` records it), and `timeline/timestamps.csv`
128
+ holds per-frame timestamps. The `delays_s` in `homie_rig_calib.json` are small
129
+ residual per-camera offsets (~2 ms) that `homie_extrinsics.py` applies
130
+ automatically.
131
+
132
+ ## Accuracy / provenance
133
+
134
+ - ZED extrinsics (2026-06-22): AprilTag board (4×4 grid, 125 mm tags) tracked
135
+ by OptiTrack; 20 258 board poses, 3 882 IR-verified; median marker
136
+ consistency ≈ 39 mm, IR reprojection median ≈ 7.5 px (see `meta` in
137
+ `zed_poses_0622.json`).
138
+ - Homie hand–eye (2026-06-25, take `2026-06-25-19:49:06`): 1 563 board views,
139
+ reprojection median 1.64 px / p90 2.54 px (see `meta` in
140
+ `homie_rig_calib.json`).
Room-scale/calibration/homie-camchain.yaml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cam0:
2
+ cam_overlaps: [1, 2, 3]
3
+ camera_model: pinhole
4
+ distortion_coeffs: [-0.05761959903731187, 0.0029356256212510054, -0.006634361165985679, 0.0017843379743501806]
5
+ distortion_model: equidistant
6
+ intrinsics: [395.00109559502636, 394.7747916429034, 536.1617651628547, 673.6553587142616]
7
+ resolution: [1088, 1280]
8
+ rostopic: /cam2/image_raw
9
+ cam1:
10
+ T_cn_cnm1:
11
+ - [-0.8757267034226962, -0.4334105804454474, -0.21273929977874914, -0.03558586437354394]
12
+ - [0.430325390635062, -0.5008877925235563, -0.7509537119394611, -0.1266418904865405]
13
+ - [0.21891276593016093, -0.7491773408605029, 0.625148392666883, -0.06172188622562206]
14
+ - [0.0, 0.0, 0.0, 1.0]
15
+ cam_overlaps: [0, 2, 3]
16
+ camera_model: pinhole
17
+ distortion_coeffs: [-0.05447515001895322, -0.004585362477944007, -0.0014068764700961882, 0.0007025151712548356]
18
+ distortion_model: equidistant
19
+ intrinsics: [393.55340406395106, 393.28715684686443, 542.2206853120093, 657.4503753501341]
20
+ resolution: [1088, 1280]
21
+ rostopic: /cam1/image_raw
22
+ cam2:
23
+ T_cn_cnm1:
24
+ - [-0.5375188088397032, 0.24936962591266637, 0.8055360450133361, 0.12970697966945538]
25
+ - [-0.25669503412415545, 0.8615487000157906, -0.4379971426357756, -0.07346810254112937]
26
+ - [-0.8032317160069996, -0.4422088049477103, -0.39908668635670197, -0.22362519911425208]
27
+ - [0.0, 0.0, 0.0, 1.0]
28
+ cam_overlaps: [0, 1, 3]
29
+ camera_model: pinhole
30
+ distortion_coeffs: [-0.05836168773666623, 0.0007872549620501365, -0.00629456849079218, 0.002390768156079088]
31
+ distortion_model: equidistant
32
+ intrinsics: [395.4542533845256, 395.5537951778382, 545.8560606598916, 657.9798005111777]
33
+ resolution: [1088, 1280]
34
+ rostopic: /cam0/image_raw
35
+ cam3:
36
+ T_cn_cnm1:
37
+ - [-0.6251662803454691, 0.4297032782530559, -0.6515536927817833, -0.10028190094522217]
38
+ - [-0.43520354339784484, 0.5010539057936366, 0.7480259750188444, 0.11509551220532377]
39
+ - [0.6478927362866185, 0.75119909221691, -0.1262336172321775, -0.17129991531294733]
40
+ - [0.0, 0.0, 0.0, 1.0]
41
+ cam_overlaps: [0, 1, 2]
42
+ camera_model: pinhole
43
+ distortion_coeffs: [-0.056216443478993725, -0.005317845099511976, -6.621165624969179e-05, 0.00011839559082425627]
44
+ distortion_model: equidistant
45
+ intrinsics: [395.72395165269614, 395.26038160815466, 538.9967644789181, 641.4500725845512]
46
+ resolution: [1088, 1280]
47
+ rostopic: /cam3/image_raw
Room-scale/calibration/homie_rig_calib.json ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "T_homie_cam": {
3
+ "front_left": [
4
+ [
5
+ -0.3549473773367149,
6
+ 0.7731296300861267,
7
+ 0.5256262307045535,
8
+ 93.11548227007071
9
+ ],
10
+ [
11
+ -0.7610144640058892,
12
+ 0.08762696025357442,
13
+ -0.6427896245355453,
14
+ -57.96410434109294
15
+ ],
16
+ [
17
+ -0.5430187334665505,
18
+ -0.6281656556352053,
19
+ 0.5572598713210704,
20
+ 132.95426611968767
21
+ ],
22
+ [
23
+ 0.0,
24
+ 0.0,
25
+ 0.0,
26
+ 1.0
27
+ ]
28
+ ],
29
+ "front_right": [
30
+ [
31
+ -0.13452028496833032,
32
+ -0.9345983032879102,
33
+ -0.32928757101263073,
34
+ -49.311461444736125
35
+ ],
36
+ [
37
+ 0.7693416456168276,
38
+ 0.11092852405914028,
39
+ -0.6291329707380244,
40
+ -58.8735087137323
41
+ ],
42
+ [
43
+ 0.6245139912376908,
44
+ -0.33796578827067636,
45
+ 0.7041032599746637,
46
+ 155.1038195428959
47
+ ],
48
+ [
49
+ 0.0,
50
+ 0.0,
51
+ 0.0,
52
+ 1.0
53
+ ]
54
+ ],
55
+ "back_left": [
56
+ [
57
+ -0.427519343994489,
58
+ -0.6254046380017881,
59
+ 0.6527604838502205,
60
+ 104.87394699848096
61
+ ],
62
+ [
63
+ -0.8917437243280575,
64
+ 0.17322360831466832,
65
+ -0.418075007198435,
66
+ -17.983993816986075
67
+ ],
68
+ [
69
+ 0.14839252215676835,
70
+ -0.7608302177807467,
71
+ -0.6317571044948007,
72
+ -60.001207100533925
73
+ ],
74
+ [
75
+ 0.0,
76
+ 0.0,
77
+ 0.0,
78
+ 1.0
79
+ ]
80
+ ],
81
+ "back_right": [
82
+ [
83
+ -0.4364460688534747,
84
+ 0.35727935820319107,
85
+ -0.8257519537877362,
86
+ -119.74332013301124
87
+ ],
88
+ [
89
+ 0.8997196441230979,
90
+ 0.16881707394472178,
91
+ -0.4024988913323215,
92
+ -15.546167795409245
93
+ ],
94
+ [
95
+ -0.004403516930124807,
96
+ -0.9186143128357285,
97
+ -0.3951308052936245,
98
+ -23.633891937619335
99
+ ],
100
+ [
101
+ 0.0,
102
+ 0.0,
103
+ 0.0,
104
+ 1.0
105
+ ]
106
+ ]
107
+ },
108
+ "delays_s": {
109
+ "front_left": 0.002258018664379698,
110
+ "front_right": 0.0020811559852302918,
111
+ "back_left": 0.0024979296001485622,
112
+ "back_right": 0.002134785077434174
113
+ },
114
+ "meta": {
115
+ "source_take": "2026-06-25-19:49:06",
116
+ "reproj_px_median": 1.6397870960141963,
117
+ "reproj_px_p90": 2.540545231473632,
118
+ "n_board_views": 1563,
119
+ "generated_at": "2026-06-25T20:33:10"
120
+ }
121
+ }
Room-scale/calibration/scripts/__pycache__/homie_extrinsics.cpython-313.pyc ADDED
Binary file (29.5 kB). View file
 
Room-scale/calibration/scripts/homie_extrinsics.py ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ homie_extrinsics.py — per-frame camera poses for the 4-fisheye Homie rig.
4
+
5
+ Input : a take directory in the released layout, e.g.
6
+ python homie_extrinsics.py /mnt/sync_data/<take>
7
+ detected by the presence of `raw/egocentric_raw/`; it reads the Motive
8
+ export from `raw/mocap_raw/*.csv` and the frame<->time mapping from
9
+ `timeline/sync_timeline.csv`. The raw fisheye frame dumps are not
10
+ shipped in this layout — that's fine: the frame list comes from
11
+ sync_timeline.csv, images are only needed for --debug.
12
+ Backwards compatible: a capture-pipeline `homie/frames/` folder still
13
+ works (Motive at `motive/*.csv`, sync at `sync_timeline.csv`,
14
+ intrinsics at `homie/calibration_cache/*/camchain.yaml`).
15
+
16
+ NOTE the released `videos_and_annotations/homie_*.mp4` are the
17
+ RECTIFIED 1024x1024 pinhole views (old cam_frames/), not the raw
18
+ 1088x1280 fisheye frames — pass --rectified to get poses+intrinsics
19
+ that match those videos (video frame i = sync_timeline record i).
20
+ Output: one JSON file
21
+ {
22
+ "intrinsics": { "<cam_id>": {model, fx, fy, cx, cy, dist:[k1..k4], width, height} },
23
+ "extrinsics": { "<frame.jpg>": { "<cam_id>": [[4x4 world->cam, mm]] } }
24
+ }
25
+ World frame = OptiTrack/Motive global frame (mm). A 3D world point p projects with
26
+ the camera's Kannala-Brandt model after p_cam = (world->cam) @ [p; 1].
27
+
28
+ Pose model: T_world_cam(t) = T_world_homie(t + dt_cam) @ T_homie_cam
29
+ In the current multi-marker capture pipeline sync_timeline.csv already folds in the
30
+ Homie<->OptiTrack clock offset, so the residual global delay is ~0 and the 4 cameras are
31
+ mutually synced (<2 ms). Both delays are still configurable via --global-delay / --delay.
32
+
33
+ The rig extrinsics T_homie_cam are a fixed calibration loaded from an external JSON
34
+ (--calib, default homie_rig_calib.json found next to this script or in its parent folder)
35
+ produced by calibrate_handeye.py; future takes need only OptiTrack tracking of the "Homie"
36
+ rigid body — no calibration board. Recompute the calibration with calibrate_handeye.py
37
+ if the Homie marker set / rigid-body frame changes. Fisheye intrinsics fall back to the
38
+ shared homie-camchain.yaml when a take ships no per-take calibration_cache.
39
+ """
40
+ import os, csv, glob, json, argparse
41
+ import numpy as np
42
+ import cv2
43
+ from scipy.spatial.transform import Rotation as R, Slerp
44
+
45
+ # cam_id -> (raw frame sub-folder, camchain key). Order = camchain cam0..cam3 / debug 2x2 grid.
46
+ CAMS = {
47
+ "front_left": ("cam2", "cam0"),
48
+ "front_right": ("cam1", "cam1"),
49
+ "back_left": ("cam0", "cam2"),
50
+ "back_right": ("cam3", "cam3"),
51
+ }
52
+ ORDER = ["front_left", "front_right", "back_left", "back_right"]
53
+
54
+ # The rig calibration (T_homie_cam + per-camera time delays) is NOT hard-coded: it is loaded
55
+ # from an external JSON produced by calibrate_handeye.py (default homie_rig_calib.json next to
56
+ # this script). Re-run calibrate_handeye.py whenever the Homie marker set / rigid-body frame
57
+ # changes; homie_extrinsics.py then just picks up the new file.
58
+ def _default_file(name):
59
+ """Locate a calibration file next to this script, else in its parent folder."""
60
+ here = os.path.dirname(os.path.abspath(__file__))
61
+ for d in (here, os.path.dirname(here)):
62
+ p = os.path.join(d, name)
63
+ if os.path.isfile(p):
64
+ return p
65
+ return os.path.join(here, name)
66
+
67
+ DEFAULT_CALIB = _default_file("homie_rig_calib.json")
68
+
69
+ # Last-resort Homie camchain (intrinsics), used only when a take has no per-take
70
+ # homie/calibration_cache/*/camchain.yaml (e.g. it was rectified straight from a repo
71
+ # camchain and never got a cache). Prefer the take's own calibration — see _resolve_camchain.
72
+ DEFAULT_CAMCHAIN = _default_file("homie-camchain.yaml")
73
+
74
+ def load_calib(path):
75
+ """Load {cam_id: T_homie_cam 4x4 (np)} and {cam_id: delay_s} from a calibration JSON."""
76
+ c = json.load(open(path))
77
+ X = {cam: np.array(c["T_homie_cam"][cam], float) for cam in ORDER}
78
+ delays = {cam: float(c.get("delays_s", {}).get(cam, 0.0)) for cam in ORDER}
79
+ return X, delays, c.get("meta", {})
80
+
81
+ # -------------------------------------------------------------------------- helpers
82
+ def inv_T(T):
83
+ Ri = T[:3, :3].T
84
+ out = np.eye(4); out[:3, :3] = Ri; out[:3, 3] = -Ri @ T[:3, 3]
85
+ return out
86
+
87
+ def load_intrinsics(camchain_path):
88
+ import yaml
89
+ cc = yaml.safe_load(open(camchain_path)) # keyed by camchain entry name cam0..cam3
90
+ by_key = {}
91
+ for key, c in cc.items():
92
+ fx, fy, cx, cy = c["intrinsics"]
93
+ by_key[key] = dict(model="kannala_brandt", fx=fx, fy=fy, cx=cx, cy=cy,
94
+ dist=list(c["distortion_coeffs"]),
95
+ width=int(c["resolution"][0]), height=int(c["resolution"][1]))
96
+ return cc, by_key
97
+
98
+ def camchain_K_D(cc, key):
99
+ c = cc[key]
100
+ fx, fy, cx, cy = c["intrinsics"]
101
+ K = np.array([[fx, 0, cx], [0, fy, cy], [0, 0, 1]], float)
102
+ return K, np.array(c["distortion_coeffs"], float)
103
+
104
+ class RigidBody:
105
+ """Per-frame OptiTrack rigid-body pose with time interpolation (SLERP + linear)."""
106
+ def __init__(self, t, quats_xyzw, pos_mm):
107
+ self.t = np.asarray(t); self.slerp = Slerp(self.t, R.from_quat(quats_xyzw))
108
+ self.pos = np.asarray(pos_mm)
109
+ def pose_at(self, tq):
110
+ tq = float(np.clip(tq, self.t[0], self.t[-1]))
111
+ T = np.eye(4); T[:3, :3] = self.slerp([tq]).as_matrix()[0]
112
+ T[:3, 3] = [np.interp(tq, self.t, self.pos[:, i]) for i in range(3)]
113
+ return T
114
+
115
+ def parse_motive(csv_path):
116
+ r = list(csv.reader(open(csv_path)))
117
+ typ, name, rp, ax = r[2], r[3], r[6], r[7]
118
+ data = r[8:]
119
+ times = np.array([float(row[1]) for row in data if row[0] not in ("", "Frame")])
120
+ cols = {}
121
+ for i, (t, n, p, a) in enumerate(zip(typ, name, rp, ax)):
122
+ if t == "Rigid Body":
123
+ cols.setdefault(n, {})[(p, a)] = i
124
+ bodies = {}
125
+ for n, c in cols.items():
126
+ try:
127
+ qc = [c[("Rotation", a)] for a in "XYZW"]; pc = [c[("Position", a)] for a in "XYZ"]
128
+ except KeyError:
129
+ continue
130
+ q, p, tt = [], [], []
131
+ for row, tm in zip(data, times):
132
+ if all(row[k] not in ("", None) for k in qc + pc):
133
+ q.append([float(row[k]) for k in qc]); p.append([float(row[k]) for k in pc]); tt.append(tm)
134
+ if len(tt) >= 2:
135
+ bodies[n] = RigidBody(tt, q, p)
136
+ return bodies
137
+
138
+ def parse_sync(sync_csv):
139
+ s = list(csv.reader(open(sync_csv)))
140
+ h = {n: i for i, n in enumerate(s[0])}
141
+ recs = []
142
+ for row in s[1:]:
143
+ fl, of = row[h["homie_front_left"]], row[h["optitrack_frame_idx"]]
144
+ if not fl or not of:
145
+ continue
146
+ diff = float(row[h["homie_diff_ms"]]) if row[h["homie_diff_ms"]] else 0.0
147
+ recs.append((os.path.basename(fl).replace(".jpg", ""), int(of) / 60.0 + diff / 1000.0))
148
+ return recs
149
+
150
+ def project_fisheye(pts_world, T_cam_world, K, D):
151
+ rvec, _ = cv2.Rodrigues(T_cam_world[:3, :3]); tvec = T_cam_world[:3, 3]
152
+ proj, _ = cv2.fisheye.projectPoints(pts_world.reshape(-1, 1, 3).astype(np.float64), rvec, tvec, K, D)
153
+ cam = (T_cam_world[:3, :3] @ pts_world.T).T + T_cam_world[:3, 3]
154
+ return proj.reshape(-1, 2), cam[:, 2] > 1.0 # pixels, in-front mask
155
+
156
+ def project_pinhole(pts_world, T_cam_world, K):
157
+ cam = (T_cam_world[:3, :3] @ pts_world.T).T + T_cam_world[:3, 3]
158
+ uv = (K @ cam.T).T
159
+ return uv[:, :2] / uv[:, 2:3], cam[:, 2] > 1.0 # pixels, in-front mask
160
+
161
+ # -------------------------------------------------------------------------- rectified (pinhole) views
162
+ # cam_frames/ are stereo-rectified pinhole views (see video-sync .../core/rectify.py).
163
+ # Each rectified camera is the physical fisheye camera rotated by a fixed R_rect about its
164
+ # optical centre; the intrinsic becomes a plain pinhole K_rect (no distortion).
165
+ RECTIFY = dict(fov_deg=90.0, out=1024, zoom=0.78125, pitch=-5.0, yaw=0.0, roll=0.0) # from rectify_report.json
166
+ # stereo pairs as (camchain_key, cam_id): pair0 = front, pair1 = back; member0 -> R1, member1 -> R2
167
+ RECT_PAIRS = [(("cam0", "front_left"), ("cam1", "front_right")),
168
+ (("cam2", "back_left"), ("cam3", "back_right"))]
169
+
170
+ def _euler(pitch, yaw, roll): # matches rectify.py _euler_to_rotation_matrix
171
+ p, y, r = np.radians([pitch, yaw, roll])
172
+ cp, sp, cy, sy, cr, sr = np.cos(p), np.sin(p), np.cos(y), np.sin(y), np.cos(r), np.sin(r)
173
+ return np.array([[cr*cy, cr*sy*sp - sr*cp, cr*sy*cp + sr*sp],
174
+ [sr*cy, sr*sy*sp + cr*cp, sr*sy*cp - cr*sp],
175
+ [-sy, cy*sp, cy*cp]])
176
+
177
+ def rectify_params(cc):
178
+ """({cam_id: R_rect (3x3, physical->rectified)}, K_rect (3x3 pinhole)), matching cam_frames/."""
179
+ cfg = RECTIFY
180
+ R_view = _euler(cfg["pitch"], cfg["yaw"], cfg["roll"])
181
+ W = cfg["out"]; fx = W / (2*np.tan(np.radians(cfg["fov_deg"])/2)) * cfg["zoom"]
182
+ Krect = np.array([[fx, 0, W/2.0], [0, fx, W/2.0], [0, 0, 1.0]])
183
+ Rr = {}
184
+ for (lk, lcam), (rk, rcam) in RECT_PAIRS:
185
+ K0, D0 = camchain_K_D(cc, lk); K1, D1 = camchain_K_D(cc, rk)
186
+ size = (int(cc[lk]["resolution"][0]), int(cc[lk]["resolution"][1]))
187
+ T = np.array(cc[rk]["T_cn_cnm1"], float)
188
+ R1, R2, *_ = cv2.fisheye.stereoRectify(
189
+ K0, D0.reshape(4, 1), K1, D1.reshape(4, 1), size, T[:3, :3], T[:3, 3],
190
+ flags=cv2.CALIB_ZERO_DISPARITY, newImageSize=size, balance=0.0, fov_scale=1.0)
191
+ Rr[lcam] = R_view @ R1
192
+ Rr[rcam] = R_view @ R2
193
+ return Rr, Krect
194
+
195
+ # -------------------------------------------------------------------------- main
196
+ def _resolve_camchain(homie_dir):
197
+ """Locate the Homie camchain (intrinsics) for a take, tolerating a missing cache.
198
+
199
+ Preference order (so takes rectified without a per-take calibration_cache still work
200
+ instead of crashing with IndexError):
201
+ 1. the take's own homie/calibration_cache/*/camchain.yaml (normal case);
202
+ 2. the camchain the take was rectified with, recorded in
203
+ homie/cam_frames/rectify_report.json ("calibration_json_path") — per-take correct;
204
+ 3. the repo default DEFAULT_CAMCHAIN (current Homie unit).
205
+ """
206
+ hits = sorted(glob.glob(os.path.join(homie_dir, "calibration_cache", "*", "camchain.yaml")))
207
+ if hits:
208
+ return hits[0]
209
+ report = os.path.join(homie_dir, "cam_frames", "rectify_report.json")
210
+ if os.path.isfile(report):
211
+ try:
212
+ cc = (json.load(open(report)) or {}).get("calibration_json_path")
213
+ except Exception:
214
+ cc = None
215
+ if cc and os.path.isfile(cc):
216
+ print(f"[camchain] {homie_dir}: no calibration_cache; using rectify_report camchain {cc}", flush=True)
217
+ return cc
218
+ if os.path.isfile(DEFAULT_CAMCHAIN):
219
+ print(f"[camchain] {homie_dir}: no calibration_cache/rectify_report; using default {DEFAULT_CAMCHAIN}", flush=True)
220
+ return DEFAULT_CAMCHAIN
221
+ raise FileNotFoundError(
222
+ f"No Homie camchain for take at {homie_dir}: none under calibration_cache/*/camchain.yaml, "
223
+ f"no usable calibration_json_path in cam_frames/rectify_report.json, and no default at "
224
+ f"{DEFAULT_CAMCHAIN}.")
225
+
226
+ def resolve_paths(path):
227
+ """Accept either a take directory in the released layout
228
+ (<take>/raw/egocentric_raw + <take>/timeline/sync_timeline.csv) or, for
229
+ backwards compatibility, a capture-pipeline homie/frames/ folder."""
230
+ path = os.path.abspath(path)
231
+ if os.path.isdir(os.path.join(path, "raw", "egocentric_raw")):
232
+ take_dir = path
233
+ homie_dir = os.path.join(take_dir, "raw", "egocentric_raw")
234
+ frames_dir = os.path.join(homie_dir, "frames") # raw frame dumps are not shipped; only used by --debug
235
+ motive_glob = os.path.join(take_dir, "raw", "mocap_raw", "*.csv")
236
+ sync = os.path.join(take_dir, "timeline", "sync_timeline.csv")
237
+ toff = os.path.join(take_dir, "timeline", "homie_time_offset.json")
238
+ else:
239
+ frames_dir = path
240
+ homie_dir = os.path.dirname(frames_dir)
241
+ take_dir = os.path.dirname(homie_dir)
242
+ motive_glob = os.path.join(take_dir, "motive", "*.csv")
243
+ sync = os.path.join(take_dir, "sync_timeline.csv")
244
+ toff = os.path.join(take_dir, "homie_time_offset.json")
245
+ camchain = _resolve_camchain(homie_dir)
246
+ csvs = [f for f in glob.glob(motive_glob)
247
+ if "frames" not in os.path.basename(f) and "Manus" not in f]
248
+ return dict(frames=frames_dir, take=take_dir, camchain=camchain,
249
+ motive=csvs[0], sync=sync, time_offset=toff)
250
+
251
+ def main():
252
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
253
+ ap.add_argument("frames_dir",
254
+ help="a take directory (released layout with raw/egocentric_raw + timeline/), "
255
+ "or a capture-pipeline homie/frames/ folder (old layout)")
256
+ ap.add_argument("--calib", default=DEFAULT_CALIB,
257
+ help="rig calibration JSON from calibrate_handeye.py (T_homie_cam + delays); "
258
+ "default homie_rig_calib.json next to this script")
259
+ ap.add_argument("--delay", nargs=4, type=float, default=None,
260
+ metavar=("cam0", "cam1", "cam2", "cam3"),
261
+ help="extra per-camera delay in seconds added on top of the calibration delays "
262
+ "(cam0..cam3 = front_left,front_right,back_left,back_right)")
263
+ ap.add_argument("--global-delay", type=float, default=None,
264
+ help="extra global delay (s) added to every camera on top of the calibration")
265
+ ap.add_argument("--out", default="homie_poses.json", help="output JSON path")
266
+ ap.add_argument("--rectified", action="store_true",
267
+ help="output poses+intrinsics for the rectified pinhole views (homie/cam_frames/) "
268
+ "instead of the raw fisheye frames")
269
+ ap.add_argument("--debug", metavar="VIDEO.mp4", default=None,
270
+ help="render a 2x2 reprojection-overlay video")
271
+ ap.add_argument("--debug-step", type=int, default=3, help="use every Nth frame in --debug")
272
+ ap.add_argument("--objects", default=None,
273
+ help="comma-separated rigid-body names to overlay in --debug "
274
+ "(default: every OptiTrack rigid body except 'Homie')")
275
+ args = ap.parse_args()
276
+
277
+ P = resolve_paths(args.frames_dir)
278
+ cc, intr_json = load_intrinsics(P["camchain"])
279
+ bodies = parse_motive(P["motive"])
280
+ homie = bodies["Homie"]
281
+ recs = parse_sync(P["sync"])
282
+
283
+ X, base_delay, meta = load_calib(args.calib)
284
+ g = args.global_delay or 0.0
285
+ dt = {cam: base_delay[cam] + g + (args.delay[i] if args.delay else 0.0)
286
+ for i, cam in enumerate(ORDER)}
287
+ print(f"calib: {os.path.basename(args.calib)} (source {meta.get('source_take','?')}, "
288
+ f"reproj {meta.get('reproj_px_median','?')} px) ; per-camera dt (ms) = "
289
+ f"{ {c: round(dt[c]*1000,1) for c in ORDER} }")
290
+
291
+ # ---- rectified (pinhole) views: fold in the fixed per-camera rectification rotation ----
292
+ rect = rectify_params(cc) if args.rectified else None
293
+ if rect:
294
+ Rr, Krect = rect
295
+ print(f"rectified pinhole views: fx=fy={Krect[0,0]:.1f}, cx=cy={Krect[0,2]:.1f}, "
296
+ f"{RECTIFY['out']}x{RECTIFY['out']}, no distortion")
297
+
298
+ # ---- per-frame world->cam ----
299
+ extr = {}
300
+ for stem, t in recs:
301
+ per_cam = {}
302
+ for cam in ORDER:
303
+ Tcw = inv_T(homie.pose_at(t + dt[cam]) @ X[cam]) # world -> physical cam
304
+ if rect:
305
+ R4 = np.eye(4); R4[:3, :3] = Rr[cam]
306
+ Tcw = R4 @ Tcw # world -> rectified cam
307
+ per_cam[cam] = Tcw.tolist()
308
+ extr[stem + ".jpg"] = per_cam
309
+
310
+ if rect:
311
+ Rr, Krect = rect
312
+ intrinsics = {cam: dict(model="pinhole", fx=Krect[0, 0], fy=Krect[1, 1],
313
+ cx=Krect[0, 2], cy=Krect[1, 2], dist=[0.0, 0.0, 0.0, 0.0],
314
+ width=RECTIFY["out"], height=RECTIFY["out"]) for cam in ORDER}
315
+ else:
316
+ intrinsics = {cam: intr_json[CAMS[cam][1]] for cam in ORDER}
317
+ out = {"intrinsics": intrinsics, "extrinsics": extr}
318
+ json.dump(out, open(args.out, "w"))
319
+ kind = "rectified pinhole" if rect else "raw fisheye"
320
+ print(f"wrote {args.out}: {len(extr)} frames x {len(ORDER)} cameras ({kind})")
321
+
322
+ if args.debug:
323
+ sel = [s.strip() for s in args.objects.split(",")] if args.objects else None
324
+ render_debug(args.debug, P, cc, bodies, homie, recs, X, dt, args.debug_step, rect, sel)
325
+
326
+ # distinct BGR colors for auto-assigned overlay objects ("Calibration Board" pinned to red)
327
+ _PALETTE = [(0, 165, 255), (255, 255, 0), (255, 0, 255), (0, 255, 255),
328
+ (255, 128, 0), (128, 0, 255), (0, 255, 128), (200, 200, 0)]
329
+
330
+ def render_debug(out_mp4, P, cc, bodies, homie, recs, X, dt, step, rect=None, objects=None):
331
+ # default: every rigid body except the camera rig itself; optionally a user-given subset
332
+ names = objects if objects else [n for n in bodies if n != "Homie"]
333
+ missing = [n for n in names if n not in bodies]
334
+ if missing:
335
+ print(f" warning: requested objects not in motive: {missing}")
336
+ names = [n for n in names if n in bodies]
337
+ COLORS, i = {}, 0
338
+ for n in names:
339
+ if n == "Calibration Board":
340
+ COLORS[n] = (0, 0, 255)
341
+ else:
342
+ COLORS[n] = _PALETTE[i % len(_PALETTE)]; i += 1
343
+ objs = {n: bodies[n] for n in names}
344
+ print(f" overlaying objects: {names}")
345
+ KD = {cam: camchain_K_D(cc, CAMS[cam][1]) for cam in ORDER}
346
+ rect_dir = os.path.join(os.path.dirname(P["frames"]), "cam_frames") # rectified images
347
+ tile = 512
348
+ vw = cv2.VideoWriter(out_mp4, cv2.VideoWriter_fourcc(*"mp4v"), 15, (2 * tile, 2 * tile))
349
+ axes = np.array([[0, 0, 0], [150, 0, 0], [0, 150, 0], [0, 0, 150]], float)
350
+ for stem, t in recs[::step]:
351
+ cells = []
352
+ for cam in ORDER:
353
+ folder, key = CAMS[cam]; K, D = KD[cam]
354
+ if rect:
355
+ img = cv2.imread(os.path.join(rect_dir, cam, stem + ".jpg"))
356
+ if img is None:
357
+ img = np.zeros((RECTIFY["out"], RECTIFY["out"], 3), np.uint8)
358
+ else:
359
+ img = cv2.imread(os.path.join(P["frames"], folder, stem + ".jpg"))
360
+ if img is None:
361
+ img = np.zeros((1280, 1088, 3), np.uint8)
362
+ Tcw = inv_T(homie.pose_at(t + dt[cam]) @ X[cam])
363
+ if rect:
364
+ R4 = np.eye(4); R4[:3, :3] = rect[0][cam]; Tcw = R4 @ Tcw
365
+ for name, rb in objs.items():
366
+ To = rb.pose_at(t + dt[cam])
367
+ wp = (To[:3, :3] @ axes.T).T + To[:3, 3]
368
+ if rect:
369
+ ap, infront = project_pinhole(wp, Tcw, rect[1])
370
+ else:
371
+ ap, infront = project_fisheye(wp, Tcw, K, D)
372
+ o = ap[0]
373
+ if not infront[0] or not (0 <= o[0] < img.shape[1] and 0 <= o[1] < img.shape[0]):
374
+ continue
375
+ for j, c in zip([1, 2, 3], [(0, 0, 255), (0, 255, 0), (255, 0, 0)]):
376
+ if infront[j]:
377
+ cv2.line(img, tuple(o.astype(int)), tuple(ap[j].astype(int)), c, 2)
378
+ cv2.circle(img, tuple(o.astype(int)), 6, COLORS[name], 2)
379
+ cv2.putText(img, name, tuple((o + [8, -8]).astype(int)),
380
+ cv2.FONT_HERSHEY_SIMPLEX, 0.6, COLORS[name], 2)
381
+ cell = cv2.resize(img, (tile, tile))
382
+ cv2.putText(cell, cam, (10, 28), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 255), 2)
383
+ cells.append(cell)
384
+ grid = np.vstack([np.hstack([cells[0], cells[1]]), np.hstack([cells[2], cells[3]])])
385
+ vw.write(grid)
386
+ vw.release()
387
+ print(f"wrote {out_mp4}")
388
+
389
+ if __name__ == "__main__":
390
+ main()
Room-scale/calibration/scripts/visualize/README.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ZED + Homie + OptiTrack/SMPL Rerun viewer
2
+
3
+ This tool shows all calibrated camera poses in the OptiTrack Y-up world, places the synchronized RGB stream on every camera frustum, and animates the pre-baked SMPL-X mesh.
4
+
5
+ By default only one JPEG frame per camera is transferred and placed on its frustum. Pass `--full-video` only when complete video playback is needed.
6
+
7
+ The default view includes all eight ZED cameras, twelve calibrated OptiTrack IR cameras, and one virtual forehead Homie camera. The Homie camera uses the front-left RGB image and the midpoint pose of the calibrated front-left/right optical cameras.
8
+
9
+ The individual room object meshes are the opaque, colorful primary geometry, except `table_cook.obj`, which is intentionally excluded. When present, `scene.obj` is also loaded as a translucent neutral context layer to fill geometry missing from the individual parts. Pass `--no-room-assets` to disable all room geometry.
10
+
11
+ Floor and horizontal center alignment are enabled by default. Add a measured correction with `--asset-translation DX DY DZ` (meters), use `--no-auto-asset-align` to disable only the center heuristic, or `--no-room-alignment` to disable all alignment and CLI offsets.
12
+
13
+ Persist a manual rotation with `--asset-rotation-deg RX RY RZ`; angles are degrees about world X/Y/Z and compose as `Rz @ Ry @ Rx`.
14
+
15
+ The Gradio translation/rotation panel starts by default on `web-port + 2`. Use `--no-room-controls` to disable it. Its offsets are applied on top of the automatic alignment result.
16
+
17
+ When room assets are enabled, the accumulated default correction is `--asset-translation 0.12 -0.52 0.79 --asset-rotation-deg 0 62 0`. Camera frustums use moderately compact image-plane distances: 0.32 m for ZED/OptiTrack and 0.24 m for Homie.
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ cd /home/acerobotics/visualize
23
+ python -m venv .venv
24
+ .venv/bin/pip install -r requirements.txt
25
+ ```
26
+
27
+ ## Run
28
+
29
+ The server is headless, so run the logger there:
30
+
31
+ ```bash
32
+ .venv/bin/python visualize_case.py /mnt/Datasets/2026-06-27-12:26:35
33
+ ```
34
+
35
+ It first writes a temporary `.rrd`, then starts a persistent Web Viewer for that file on server port 9090. On your **local** machine, create an SSH tunnel (replace the host if needed):
36
+
37
+ ```bash
38
+ ssh -N \
39
+ -L 9090:127.0.0.1:9090 \
40
+ acerobotics@AceRobotics-Server01
41
+ ```
42
+
43
+ The data proxy uses the next port, so for `--web-port 9091`, forward both 9091 and 9092. Open the exact URL printed by the script.
44
+
45
+ If 9090 is occupied by an older server, add `--web-port 9091` and tunnel/open port 9091 instead.
46
+
47
+ Keep both the SSH tunnel and the server-side logger running while viewing. After logging completes, the logger deliberately stays alive to host the recording; press `Ctrl+C` when finished.
48
+
49
+ To use a separately managed Rerun server instead, start it with `.venv/bin/rerun --serve-web`, then pass `--connect rerun+http://127.0.0.1:9876/proxy` to the logger.
50
+
51
+ Useful options:
52
+
53
+ ```bash
54
+ # Quick 10-second check with fewer cameras and a 10 Hz body mesh
55
+ .venv/bin/python visualize_case.py DATA_CASE --zed 0,1 --homie front_left,front_right --duration 10 --mesh-fps 10
56
+
57
+ # Save a recording instead of opening the viewer
58
+ .venv/bin/python visualize_case.py DATA_CASE --save output.rrd
59
+
60
+ # Camera-only or mesh-only variants
61
+ .venv/bin/python visualize_case.py DATA_CASE --no-smpl
62
+ .venv/bin/python visualize_case.py DATA_CASE --no-video
63
+ .venv/bin/python visualize_case.py DATA_CASE --full-video
64
+ ```
65
+
66
+ The default calibration snapshots in `config/` correspond to the rig calibration used by this case. Override them with `--zed-calib`, `--homie-calib`, and `--homie-camchain` for a case recorded with different hardware calibration.
67
+
68
+ Notes:
69
+
70
+ - The full 225-second case is large. `--mesh-fps 15` is the default compromise; use 5–10 Hz for fast inspection or 60 Hz for every SMPL frame.
71
+ - Default web mode writes a temporary RRD under `/tmp`; use `--save PATH.rrd` if you want to keep the recording permanently.
72
+ - Single-frame mode is the default and needs little proxy memory. Full-video mode can be several GiB; adjust `--server-memory` according to server RAM.
73
+ - ZED images contain lens distortion while Rerun's 3D textured pinhole plane is an ideal pinhole. The supplied calibrated intrinsic matrix provides the correct camera pose and a close frustum; exact distortion-aware reprojection belongs in a separate 2D overlay.
74
+ - Homie videos are the case's 1024×1024 rectified pinhole views, so their image planes use the same rectification as the exported RGB.
Room-scale/calibration/scripts/visualize/config/Calibration-Exported.mcal ADDED
Binary file (73.7 kB). View file
 
Room-scale/calibration/scripts/visualize/config/homie-camchain.yaml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cam0:
2
+ cam_overlaps: [1, 2, 3]
3
+ camera_model: pinhole
4
+ distortion_coeffs: [-0.05761959903731187, 0.0029356256212510054, -0.006634361165985679, 0.0017843379743501806]
5
+ distortion_model: equidistant
6
+ intrinsics: [395.00109559502636, 394.7747916429034, 536.1617651628547, 673.6553587142616]
7
+ resolution: [1088, 1280]
8
+ rostopic: /cam2/image_raw
9
+ cam1:
10
+ T_cn_cnm1:
11
+ - [-0.8757267034226962, -0.4334105804454474, -0.21273929977874914, -0.03558586437354394]
12
+ - [0.430325390635062, -0.5008877925235563, -0.7509537119394611, -0.1266418904865405]
13
+ - [0.21891276593016093, -0.7491773408605029, 0.625148392666883, -0.06172188622562206]
14
+ - [0.0, 0.0, 0.0, 1.0]
15
+ cam_overlaps: [0, 2, 3]
16
+ camera_model: pinhole
17
+ distortion_coeffs: [-0.05447515001895322, -0.004585362477944007, -0.0014068764700961882, 0.0007025151712548356]
18
+ distortion_model: equidistant
19
+ intrinsics: [393.55340406395106, 393.28715684686443, 542.2206853120093, 657.4503753501341]
20
+ resolution: [1088, 1280]
21
+ rostopic: /cam1/image_raw
22
+ cam2:
23
+ T_cn_cnm1:
24
+ - [-0.5375188088397032, 0.24936962591266637, 0.8055360450133361, 0.12970697966945538]
25
+ - [-0.25669503412415545, 0.8615487000157906, -0.4379971426357756, -0.07346810254112937]
26
+ - [-0.8032317160069996, -0.4422088049477103, -0.39908668635670197, -0.22362519911425208]
27
+ - [0.0, 0.0, 0.0, 1.0]
28
+ cam_overlaps: [0, 1, 3]
29
+ camera_model: pinhole
30
+ distortion_coeffs: [-0.05836168773666623, 0.0007872549620501365, -0.00629456849079218, 0.002390768156079088]
31
+ distortion_model: equidistant
32
+ intrinsics: [395.4542533845256, 395.5537951778382, 545.8560606598916, 657.9798005111777]
33
+ resolution: [1088, 1280]
34
+ rostopic: /cam0/image_raw
35
+ cam3:
36
+ T_cn_cnm1:
37
+ - [-0.6251662803454691, 0.4297032782530559, -0.6515536927817833, -0.10028190094522217]
38
+ - [-0.43520354339784484, 0.5010539057936366, 0.7480259750188444, 0.11509551220532377]
39
+ - [0.6478927362866185, 0.75119909221691, -0.1262336172321775, -0.17129991531294733]
40
+ - [0.0, 0.0, 0.0, 1.0]
41
+ cam_overlaps: [0, 1, 2]
42
+ camera_model: pinhole
43
+ distortion_coeffs: [-0.056216443478993725, -0.005317845099511976, -6.621165624969179e-05, 0.00011839559082425627]
44
+ distortion_model: equidistant
45
+ intrinsics: [395.72395165269614, 395.26038160815466, 538.9967644789181, 641.4500725845512]
46
+ resolution: [1088, 1280]
47
+ rostopic: /cam3/image_raw
Room-scale/calibration/scripts/visualize/config/homie_rig_calib.json ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "T_homie_cam": {
3
+ "front_left": [
4
+ [
5
+ -0.3549473773367149,
6
+ 0.7731296300861267,
7
+ 0.5256262307045535,
8
+ 93.11548227007071
9
+ ],
10
+ [
11
+ -0.7610144640058892,
12
+ 0.08762696025357442,
13
+ -0.6427896245355453,
14
+ -57.96410434109294
15
+ ],
16
+ [
17
+ -0.5430187334665505,
18
+ -0.6281656556352053,
19
+ 0.5572598713210704,
20
+ 132.95426611968767
21
+ ],
22
+ [
23
+ 0.0,
24
+ 0.0,
25
+ 0.0,
26
+ 1.0
27
+ ]
28
+ ],
29
+ "front_right": [
30
+ [
31
+ -0.13452028496833032,
32
+ -0.9345983032879102,
33
+ -0.32928757101263073,
34
+ -49.311461444736125
35
+ ],
36
+ [
37
+ 0.7693416456168276,
38
+ 0.11092852405914028,
39
+ -0.6291329707380244,
40
+ -58.8735087137323
41
+ ],
42
+ [
43
+ 0.6245139912376908,
44
+ -0.33796578827067636,
45
+ 0.7041032599746637,
46
+ 155.1038195428959
47
+ ],
48
+ [
49
+ 0.0,
50
+ 0.0,
51
+ 0.0,
52
+ 1.0
53
+ ]
54
+ ],
55
+ "back_left": [
56
+ [
57
+ -0.427519343994489,
58
+ -0.6254046380017881,
59
+ 0.6527604838502205,
60
+ 104.87394699848096
61
+ ],
62
+ [
63
+ -0.8917437243280575,
64
+ 0.17322360831466832,
65
+ -0.418075007198435,
66
+ -17.983993816986075
67
+ ],
68
+ [
69
+ 0.14839252215676835,
70
+ -0.7608302177807467,
71
+ -0.6317571044948007,
72
+ -60.001207100533925
73
+ ],
74
+ [
75
+ 0.0,
76
+ 0.0,
77
+ 0.0,
78
+ 1.0
79
+ ]
80
+ ],
81
+ "back_right": [
82
+ [
83
+ -0.4364460688534747,
84
+ 0.35727935820319107,
85
+ -0.8257519537877362,
86
+ -119.74332013301124
87
+ ],
88
+ [
89
+ 0.8997196441230979,
90
+ 0.16881707394472178,
91
+ -0.4024988913323215,
92
+ -15.546167795409245
93
+ ],
94
+ [
95
+ -0.004403516930124807,
96
+ -0.9186143128357285,
97
+ -0.3951308052936245,
98
+ -23.633891937619335
99
+ ],
100
+ [
101
+ 0.0,
102
+ 0.0,
103
+ 0.0,
104
+ 1.0
105
+ ]
106
+ ]
107
+ },
108
+ "delays_s": {
109
+ "front_left": 0.002258018664379698,
110
+ "front_right": 0.0020811559852302918,
111
+ "back_left": 0.0024979296001485622,
112
+ "back_right": 0.002134785077434174
113
+ },
114
+ "meta": {
115
+ "source_take": "2026-06-25-19:49:06",
116
+ "reproj_px_median": 1.6397870960141963,
117
+ "reproj_px_p90": 2.540545231473632,
118
+ "n_board_views": 1563,
119
+ "generated_at": "2026-06-25T20:33:10"
120
+ }
121
+ }
Room-scale/calibration/scripts/visualize/config/zed_poses_0622.json ADDED
@@ -0,0 +1,939 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "meta": {
3
+ "world_frame": "OptiTrack Motive world (Y-up, mm), identical to the Motive CSV export and the .mcal extrinsics",
4
+ "convention": "T_c2w: camera\u2192world, X_w = R@X_c + t (OpenCV camera axes: +Z forward, +X right, +Y down). Units: mm.",
5
+ "board": {
6
+ "tag_size_mm": 125.0,
7
+ "tag_gap_mm": 25.0,
8
+ "grid": 4,
9
+ "dict": "DICT_6X6_100"
10
+ },
11
+ "board_pose_source": "markers",
12
+ "n_ir_verified_poses": 3882,
13
+ "n_board_poses": 20258,
14
+ "ir_reproj_median_px": 7.548271327933806,
15
+ "marker_dist_p50_mm": 39.12134911198805,
16
+ "marker_offsets_board_mm": [
17
+ [
18
+ -288.62159175255556,
19
+ -291.06153400015074,
20
+ 25.133356793384934
21
+ ],
22
+ [
23
+ -290.1209460605521,
24
+ 294.3529408890757,
25
+ 26.390675068946763
26
+ ],
27
+ [
28
+ 298.1737594059931,
29
+ -290.8108225513729,
30
+ 25.0169032934206
31
+ ],
32
+ [
33
+ 299.03794657445195,
34
+ 297.11916556598663,
35
+ 22.719542171416467
36
+ ]
37
+ ],
38
+ "inputs": {
39
+ "mcal": "Calibration-Exported.mcal",
40
+ "zed_intrinsics": "zed_intrinsics.json",
41
+ "optitrack_dir": "/home/acerobotics/Videos/Calibration_Board_0610_OTE",
42
+ "zed_dir": "/home/acerobotics/Videos/Calibration_Board_0610_ZED/frames_synsplice_tmp",
43
+ "timestamps": "/home/acerobotics/Videos/Calibration_Board_0610_ZED/timestamps_opt.csv",
44
+ "optitrack_csv": "/home/acerobotics/Videos/Calibration_Board_0610/Calibration_Board_0610.csv",
45
+ "output": "zed_poses_in_optitrack.json",
46
+ "zed_cameras": "None",
47
+ "max_frames": "20000",
48
+ "workers": "None",
49
+ "subpix": "False",
50
+ "ir_gamma": "3.0",
51
+ "min_markers": "2",
52
+ "min_cams": "3",
53
+ "max_reproj_cam": "25.0",
54
+ "max_reproj_frame": "12.0",
55
+ "max_angle_gap": "360.0",
56
+ "marker_tol": "150.0",
57
+ "keep_unverified": "False",
58
+ "max_board_speed": "50.0",
59
+ "board_pose_source": "markers",
60
+ "marker_fit_tol": "10.0",
61
+ "max_sync_diff_ms": "8.0",
62
+ "max_reproj_zed": "4.0",
63
+ "max_corner_radius": "700.0",
64
+ "huber_delta": "5.0",
65
+ "trim_ratio": "3.0",
66
+ "test_fraction": "0.2",
67
+ "joint_rounds": "3",
68
+ "ir_weight": "0.1",
69
+ "marker_weight": "2.0",
70
+ "refine_offsets": "True"
71
+ }
72
+ },
73
+ "cameras": {
74
+ "0": {
75
+ "K": [
76
+ [
77
+ 736.311,
78
+ 0.0,
79
+ 967.372
80
+ ],
81
+ [
82
+ 0.0,
83
+ 735.838,
84
+ 488.696
85
+ ],
86
+ [
87
+ 0.0,
88
+ 0.0,
89
+ 1.0
90
+ ]
91
+ ],
92
+ "dist": [
93
+ 0.1236,
94
+ 0.0684,
95
+ 0.0003,
96
+ -0.0002,
97
+ -0.0415,
98
+ 0.1238,
99
+ 0.1235,
100
+ -0.0557
101
+ ],
102
+ "width": 1920,
103
+ "height": 1080,
104
+ "T_c2w": [
105
+ [
106
+ 0.8264854337212932,
107
+ 0.17858117294725595,
108
+ 0.5338825643484792,
109
+ -4498.1092102048615
110
+ ],
111
+ [
112
+ 0.04814999502482596,
113
+ 0.9224529420283858,
114
+ -0.3830954812083858,
115
+ 1740.7154835801487
116
+ ],
117
+ [
118
+ -0.5608951825659008,
119
+ 0.34232927776040095,
120
+ 0.7537952372908755,
121
+ -3855.1695492073027
122
+ ],
123
+ [
124
+ 0.0,
125
+ 0.0,
126
+ 0.0,
127
+ 1.0
128
+ ]
129
+ ],
130
+ "T_w2c": [
131
+ [
132
+ 0.8264854337212932,
133
+ 0.04814999502482596,
134
+ -0.5608951825659008,
135
+ 1471.4602715227556
136
+ ],
137
+ [
138
+ 0.17858117294725595,
139
+ 0.9224529420283858,
140
+ 0.34232927776040095,
141
+ 517.2869071643931
142
+ ],
143
+ [
144
+ 0.5338825643484792,
145
+ -0.3830954812083858,
146
+ 0.7537952372908755,
147
+ 5974.330760833986
148
+ ],
149
+ [
150
+ 0.0,
151
+ 0.0,
152
+ 0.0,
153
+ 1.0
154
+ ]
155
+ ],
156
+ "rvec_w2c": [
157
+ -0.3961210670788421,
158
+ -0.5978077312089015,
159
+ 0.0712224620681941
160
+ ],
161
+ "tvec_w2c_mm": [
162
+ 1471.4602715227556,
163
+ 517.2869071643931,
164
+ 5974.330760833986
165
+ ],
166
+ "position_mm": [
167
+ -4498.1092102048615,
168
+ 1740.7154835801487,
169
+ -3855.1695492073027
170
+ ],
171
+ "reproj": {
172
+ "train_mean_px": 1.7207454360764707,
173
+ "train_median_px": 1.4519597739379129,
174
+ "test_mean_px": 2.354627349748447,
175
+ "test_median_px": 2.098143603810553,
176
+ "n_train_frames": 180,
177
+ "n_trimmed": 6,
178
+ "n_test_frames": 47,
179
+ "n_train_corners": 6052
180
+ }
181
+ },
182
+ "1": {
183
+ "K": [
184
+ [
185
+ 737.293,
186
+ 0.0,
187
+ 941.367
188
+ ],
189
+ [
190
+ 0.0,
191
+ 736.89,
192
+ 540.694
193
+ ],
194
+ [
195
+ 0.0,
196
+ 0.0,
197
+ 1.0
198
+ ]
199
+ ],
200
+ "dist": [
201
+ 0.1276,
202
+ 0.068,
203
+ 0.0003,
204
+ -0.0002,
205
+ -0.0468,
206
+ 0.1284,
207
+ 0.1239,
208
+ -0.0618
209
+ ],
210
+ "width": 1920,
211
+ "height": 1080,
212
+ "T_c2w": [
213
+ [
214
+ -0.1273677302838765,
215
+ 0.5611442706308235,
216
+ 0.817859748869288,
217
+ -3086.3578269629165
218
+ ],
219
+ [
220
+ 0.02898380564134284,
221
+ 0.8263289974884052,
222
+ -0.5624413986544308,
223
+ 1595.3929826393905
224
+ ],
225
+ [
226
+ -0.9914319947897983,
227
+ -0.04793219636119889,
228
+ -0.1215117453545661,
229
+ 4665.762385022123
230
+ ],
231
+ [
232
+ 0.0,
233
+ 0.0,
234
+ 0.0,
235
+ 1.0
236
+ ]
237
+ ],
238
+ "T_w2c": [
239
+ [
240
+ -0.1273677302838765,
241
+ 0.02898380564134284,
242
+ -0.9914319947897983,
243
+ 4186.443157203164
244
+ ],
245
+ [
246
+ 0.5611442706308235,
247
+ 0.8263289974884052,
248
+ -0.04793219636119889,
249
+ 637.2127665859709
250
+ ],
251
+ [
252
+ 0.817859748869288,
253
+ -0.5624413986544308,
254
+ -0.1215117453545661,
255
+ 3988.4678286535363
256
+ ],
257
+ [
258
+ 0.0,
259
+ 0.0,
260
+ 0.0,
261
+ 1.0
262
+ ]
263
+ ],
264
+ "rvec_w2c": [
265
+ -0.4694560197186951,
266
+ -1.6508604641127633,
267
+ 0.48556164327500106
268
+ ],
269
+ "tvec_w2c_mm": [
270
+ 4186.443157203164,
271
+ 637.2127665859709,
272
+ 3988.4678286535363
273
+ ],
274
+ "position_mm": [
275
+ -3086.3578269629165,
276
+ 1595.3929826393905,
277
+ 4665.762385022123
278
+ ],
279
+ "reproj": {
280
+ "train_mean_px": 2.9123992347237126,
281
+ "train_median_px": 2.2898165257514562,
282
+ "test_mean_px": 4.850453175326985,
283
+ "test_median_px": 2.715830090531422,
284
+ "n_train_frames": 627,
285
+ "n_trimmed": 0,
286
+ "n_test_frames": 157,
287
+ "n_train_corners": 18876
288
+ }
289
+ },
290
+ "2": {
291
+ "K": [
292
+ [
293
+ 737.587,
294
+ 0.0,
295
+ 959.519
296
+ ],
297
+ [
298
+ 0.0,
299
+ 737.055,
300
+ 522.671
301
+ ],
302
+ [
303
+ 0.0,
304
+ 0.0,
305
+ 1.0
306
+ ]
307
+ ],
308
+ "dist": [
309
+ 0.0308,
310
+ 0.0122,
311
+ 0.0004,
312
+ -0.0001,
313
+ -0.0083,
314
+ 0.0405,
315
+ 0.0504,
316
+ -0.0177
317
+ ],
318
+ "width": 1920,
319
+ "height": 1080,
320
+ "T_c2w": [
321
+ [
322
+ 0.7645834671851738,
323
+ -0.23262169861846244,
324
+ -0.6010817473846294,
325
+ 1695.871702374565
326
+ ],
327
+ [
328
+ -0.07546393812269152,
329
+ 0.893872536651561,
330
+ -0.44192429471926337,
331
+ 2080.0126065963896
332
+ ],
333
+ [
334
+ 0.6400916463680125,
335
+ 0.38324800528112996,
336
+ 0.6658856138241177,
337
+ -3191.0268291764323
338
+ ],
339
+ [
340
+ 0.0,
341
+ 0.0,
342
+ 0.0,
343
+ 1.0
344
+ ]
345
+ ],
346
+ "T_w2c": [
347
+ [
348
+ 0.7645834671851738,
349
+ -0.07546393812269152,
350
+ 0.6400916463680125,
351
+ 902.8800932278815
352
+ ],
353
+ [
354
+ -0.23262169861846244,
355
+ 0.893872536651561,
356
+ 0.38324800528112996,
357
+ -241.8149217997485
358
+ ],
359
+ [
360
+ -0.6010817473846294,
361
+ -0.44192429471926337,
362
+ 0.6658856138241177,
363
+ 4063.4244892561123
364
+ ],
365
+ [
366
+ 0.0,
367
+ 0.0,
368
+ 0.0,
369
+ 1.0
370
+ ]
371
+ ],
372
+ "rvec_w2c": [
373
+ -0.46639607911242775,
374
+ 0.7015242808618536,
375
+ -0.088827222262893
376
+ ],
377
+ "tvec_w2c_mm": [
378
+ 902.8800932278815,
379
+ -241.8149217997485,
380
+ 4063.4244892561123
381
+ ],
382
+ "position_mm": [
383
+ 1695.871702374565,
384
+ 2080.0126065963896,
385
+ -3191.0268291764323
386
+ ],
387
+ "reproj": {
388
+ "train_mean_px": 2.0529125582436367,
389
+ "train_median_px": 1.7389845200626883,
390
+ "test_mean_px": 2.336579099817837,
391
+ "test_median_px": 1.8515414087232207,
392
+ "n_train_frames": 687,
393
+ "n_trimmed": 24,
394
+ "n_test_frames": 170,
395
+ "n_train_corners": 34480
396
+ }
397
+ },
398
+ "3": {
399
+ "K": [
400
+ [
401
+ 737.212,
402
+ 0.0,
403
+ 944.628
404
+ ],
405
+ [
406
+ 0.0,
407
+ 736.787,
408
+ 527.42
409
+ ],
410
+ [
411
+ 0.0,
412
+ 0.0,
413
+ 1.0
414
+ ]
415
+ ],
416
+ "dist": [
417
+ 0.1187,
418
+ 0.0765,
419
+ 0.0006,
420
+ -0.0003,
421
+ -0.0486,
422
+ 0.119,
423
+ 0.1331,
424
+ -0.0638
425
+ ],
426
+ "width": 1920,
427
+ "height": 1080,
428
+ "T_c2w": [
429
+ [
430
+ -0.24288073954002531,
431
+ -0.7002303881280003,
432
+ -0.6713317733450432,
433
+ 621.9878572989348
434
+ ],
435
+ [
436
+ -0.1923931548658246,
437
+ 0.7130788333718614,
438
+ -0.6741687113459065,
439
+ 1734.8587761666608
440
+ ],
441
+ [
442
+ 0.9507858961518441,
443
+ -0.0345829573509181,
444
+ -0.30791264790456296,
445
+ 4748.038734726321
446
+ ],
447
+ [
448
+ 0.0,
449
+ 0.0,
450
+ 0.0,
451
+ 1.0
452
+ ]
453
+ ],
454
+ "T_w2c": [
455
+ [
456
+ -0.24288073954002531,
457
+ -0.1923931548658246,
458
+ 0.9507858961518441,
459
+ -4029.524439401385
460
+ ],
461
+ [
462
+ -0.7002303881280003,
463
+ 0.7130788333718614,
464
+ -0.0345829573509181,
465
+ -637.3550523829739
466
+ ],
467
+ [
468
+ -0.6713317733450432,
469
+ -0.6741687113459065,
470
+ -0.30791264790456296,
471
+ 3049.128895898004
472
+ ],
473
+ [
474
+ 0.0,
475
+ 0.0,
476
+ 0.0,
477
+ 1.0
478
+ ]
479
+ ],
480
+ "rvec_w2c": [
481
+ -0.7053996802643994,
482
+ 1.789034978135712,
483
+ -0.5600941230037197
484
+ ],
485
+ "tvec_w2c_mm": [
486
+ -4029.524439401385,
487
+ -637.3550523829739,
488
+ 3049.128895898004
489
+ ],
490
+ "position_mm": [
491
+ 621.9878572989348,
492
+ 1734.8587761666608,
493
+ 4748.038734726321
494
+ ],
495
+ "reproj": {
496
+ "train_mean_px": 2.5048194609653915,
497
+ "train_median_px": 1.9828813362491196,
498
+ "test_mean_px": 5.296709982790022,
499
+ "test_median_px": 2.9605944943266476,
500
+ "n_train_frames": 1009,
501
+ "n_trimmed": 130,
502
+ "n_test_frames": 253,
503
+ "n_train_corners": 36684
504
+ }
505
+ },
506
+ "4": {
507
+ "K": [
508
+ [
509
+ 737.465,
510
+ 0.0,
511
+ 945.476
512
+ ],
513
+ [
514
+ 0.0,
515
+ 737.047,
516
+ 517.935
517
+ ],
518
+ [
519
+ 0.0,
520
+ 0.0,
521
+ 1.0
522
+ ]
523
+ ],
524
+ "dist": [
525
+ 0.1174,
526
+ 0.0709,
527
+ 0.0004,
528
+ -0.0003,
529
+ -0.0456,
530
+ 0.1168,
531
+ 0.1266,
532
+ -0.0605
533
+ ],
534
+ "width": 1920,
535
+ "height": 1080,
536
+ "T_c2w": [
537
+ [
538
+ -0.1623058952295233,
539
+ -0.17889022485241673,
540
+ -0.9703891404101731,
541
+ 3713.19484829117
542
+ ],
543
+ [
544
+ 0.0006797727246361657,
545
+ 0.9834084206660851,
546
+ -0.1814040133847063,
547
+ 1718.4154601049672
548
+ ],
549
+ [
550
+ 0.9867402567458093,
551
+ -0.030102584860567147,
552
+ -0.1594913793969019,
553
+ 2041.3929037594426
554
+ ],
555
+ [
556
+ 0.0,
557
+ 0.0,
558
+ 0.0,
559
+ 1.0
560
+ ]
561
+ ],
562
+ "T_w2c": [
563
+ [
564
+ -0.1623058952295233,
565
+ 0.0006797727246361657,
566
+ 0.9867402567458093,
567
+ -1412.8192759204858
568
+ ],
569
+ [
570
+ -0.17889022485241673,
571
+ 0.9834084206660851,
572
+ -0.030102584860567147,
573
+ -964.1987692191888
574
+ ],
575
+ [
576
+ -0.9703891404101731,
577
+ -0.1814040133847063,
578
+ -0.1594913793969019,
579
+ 4240.55598824576
580
+ ],
581
+ [
582
+ 0.0,
583
+ 0.0,
584
+ 0.0,
585
+ 1.0
586
+ ]
587
+ ],
588
+ "rvec_w2c": [
589
+ -0.133619850909165,
590
+ 1.7284128828711223,
591
+ -0.15858486293258514
592
+ ],
593
+ "tvec_w2c_mm": [
594
+ -1412.8192759204858,
595
+ -964.1987692191888,
596
+ 4240.55598824576
597
+ ],
598
+ "position_mm": [
599
+ 3713.19484829117,
600
+ 1718.4154601049672,
601
+ 2041.3929037594426
602
+ ],
603
+ "reproj": {
604
+ "train_mean_px": 1.4613748493136391,
605
+ "train_median_px": 1.1594095402838214,
606
+ "test_mean_px": 1.6130319002559326,
607
+ "test_median_px": 1.1533180102645888,
608
+ "n_train_frames": 188,
609
+ "n_trimmed": 16,
610
+ "n_test_frames": 46,
611
+ "n_train_corners": 5512
612
+ }
613
+ },
614
+ "5": {
615
+ "K": [
616
+ [
617
+ 737.302,
618
+ 0.0,
619
+ 952.888
620
+ ],
621
+ [
622
+ 0.0,
623
+ 736.73,
624
+ 526.617
625
+ ],
626
+ [
627
+ 0.0,
628
+ 0.0,
629
+ 1.0
630
+ ]
631
+ ],
632
+ "dist": [
633
+ 0.0332,
634
+ 0.0126,
635
+ 0.0007,
636
+ -0.0004,
637
+ -0.0085,
638
+ 0.0437,
639
+ 0.0496,
640
+ -0.0174
641
+ ],
642
+ "width": 1920,
643
+ "height": 1080,
644
+ "T_c2w": [
645
+ [
646
+ -0.9973782763362055,
647
+ 0.07213843493199729,
648
+ -0.005711400719771116,
649
+ -1000.5730935999982
650
+ ],
651
+ [
652
+ 0.061071558275041855,
653
+ 0.7967711654402801,
654
+ -0.6011871378304732,
655
+ 2267.0088850087623
656
+ ],
657
+ [
658
+ -0.03881801981654879,
659
+ -0.5999597954267437,
660
+ -0.7990878582540357,
661
+ 4730.89176951348
662
+ ],
663
+ [
664
+ 0.0,
665
+ 0.0,
666
+ 0.0,
667
+ 1.0
668
+ ]
669
+ ],
670
+ "T_w2c": [
671
+ [
672
+ -0.9973782763362055,
673
+ 0.061071558275041855,
674
+ -0.03881801981654879,
675
+ -952.7557822150793
676
+ ],
677
+ [
678
+ 0.07213843493199729,
679
+ 0.7967711654402801,
680
+ -0.5999597954267437,
681
+ 1104.2373238588418
682
+ ],
683
+ [
684
+ -0.005711400719771116,
685
+ -0.6011871378304732,
686
+ -0.7990878582540357,
687
+ 5137.580080859871
688
+ ],
689
+ [
690
+ 0.0,
691
+ 0.0,
692
+ 0.0,
693
+ 1.0
694
+ ]
695
+ ],
696
+ "rvec_w2c": [
697
+ -0.10977643993672742,
698
+ -2.9611351907523313,
699
+ 0.9898479160566382
700
+ ],
701
+ "tvec_w2c_mm": [
702
+ -952.7557822150793,
703
+ 1104.2373238588418,
704
+ 5137.580080859871
705
+ ],
706
+ "position_mm": [
707
+ -1000.5730935999982,
708
+ 2267.0088850087623,
709
+ 4730.89176951348
710
+ ],
711
+ "reproj": {
712
+ "train_mean_px": 2.24573616833002,
713
+ "train_median_px": 1.8089978412962404,
714
+ "test_mean_px": 4.230362441587578,
715
+ "test_median_px": 2.9070329441325065,
716
+ "n_train_frames": 1428,
717
+ "n_trimmed": 180,
718
+ "n_test_frames": 359,
719
+ "n_train_corners": 70192
720
+ }
721
+ },
722
+ "6": {
723
+ "K": [
724
+ [
725
+ 739.387,
726
+ 0.0,
727
+ 961.24
728
+ ],
729
+ [
730
+ 0.0,
731
+ 738.941,
732
+ 549.495
733
+ ],
734
+ [
735
+ 0.0,
736
+ 0.0,
737
+ 1.0
738
+ ]
739
+ ],
740
+ "dist": [
741
+ 0.0276,
742
+ 0.0066,
743
+ 0.0002,
744
+ -0.0001,
745
+ -0.0067,
746
+ 0.0367,
747
+ 0.0447,
748
+ -0.0162
749
+ ],
750
+ "width": 1920,
751
+ "height": 1080,
752
+ "T_c2w": [
753
+ [
754
+ 0.9916450051259756,
755
+ -0.02103931769764785,
756
+ -0.12726952077980477,
757
+ -822.905107559007
758
+ ],
759
+ [
760
+ -0.059829073356569874,
761
+ 0.7990615505095611,
762
+ -0.5982650921444025,
763
+ 2137.051918522988
764
+ ],
765
+ [
766
+ 0.11428326994795826,
767
+ 0.6008810078610188,
768
+ 0.791126632469119,
769
+ 600.3222048177358
770
+ ],
771
+ [
772
+ 0.0,
773
+ 0.0,
774
+ 0.0,
775
+ 1.0
776
+ ]
777
+ ],
778
+ "T_w2c": [
779
+ [
780
+ 0.9916450051259756,
781
+ -0.059829073356569874,
782
+ 0.11428326994795826,
783
+ 875.2807910147145
784
+ ],
785
+ [
786
+ -0.02103931769764785,
787
+ 0.7990615505095611,
788
+ 0.6008810078610188,
789
+ -2085.671592999592
790
+ ],
791
+ [
792
+ -0.12726952077980477,
793
+ -0.5982650921444025,
794
+ 0.791126632469119,
795
+ 698.8619399723472
796
+ ],
797
+ [
798
+ 0.0,
799
+ 0.0,
800
+ 0.0,
801
+ 1.0
802
+ ]
803
+ ],
804
+ "rvec_w2c": [
805
+ -0.6452000755181322,
806
+ 0.12996738163803703,
807
+ 0.020870812389210323
808
+ ],
809
+ "tvec_w2c_mm": [
810
+ 875.2807910147145,
811
+ -2085.671592999592,
812
+ 698.8619399723472
813
+ ],
814
+ "position_mm": [
815
+ -822.905107559007,
816
+ 2137.051918522988,
817
+ 600.3222048177358
818
+ ],
819
+ "reproj": {
820
+ "train_mean_px": 2.500777328745501,
821
+ "train_median_px": 2.07068963345984,
822
+ "test_mean_px": 4.627448446658975,
823
+ "test_median_px": 3.2401133841767678,
824
+ "n_train_frames": 1100,
825
+ "n_trimmed": 70,
826
+ "n_test_frames": 275,
827
+ "n_train_corners": 45168
828
+ }
829
+ },
830
+ "7": {
831
+ "K": [
832
+ [
833
+ 733.987,
834
+ 0.0,
835
+ 934.021
836
+ ],
837
+ [
838
+ 0.0,
839
+ 733.457,
840
+ 520.834
841
+ ],
842
+ [
843
+ 0.0,
844
+ 0.0,
845
+ 1.0
846
+ ]
847
+ ],
848
+ "dist": [
849
+ 0.1232,
850
+ 0.0888,
851
+ 0.0004,
852
+ -0.0,
853
+ -0.0489,
854
+ 0.1256,
855
+ 0.1456,
856
+ -0.0637
857
+ ],
858
+ "width": 1920,
859
+ "height": 1080,
860
+ "T_c2w": [
861
+ [
862
+ -0.04408698598699251,
863
+ -0.35887400401534364,
864
+ -0.9323442427068329,
865
+ -951.4227472070256
866
+ ],
867
+ [
868
+ -0.007197501376451948,
869
+ 0.9333415246765598,
870
+ -0.3589175313193418,
871
+ 2244.2097397499574
872
+ ],
873
+ [
874
+ 0.9990017685872827,
875
+ -0.009113043203552273,
876
+ -0.04373121085736698,
877
+ -957.9700582817479
878
+ ],
879
+ [
880
+ 0.0,
881
+ 0.0,
882
+ 0.0,
883
+ 1.0
884
+ ]
885
+ ],
886
+ "T_w2c": [
887
+ [
888
+ -0.04408698598699251,
889
+ -0.007197501376451948,
890
+ 0.9990017685872827,
891
+ 931.2211238442036
892
+ ],
893
+ [
894
+ -0.35887400401534364,
895
+ 0.9333415246765598,
896
+ -0.009113043203552273,
897
+ -2444.785053522505
898
+ ],
899
+ [
900
+ -0.9323442427068329,
901
+ -0.3589175313193418,
902
+ -0.04373121085736698,
903
+ -123.46049179867488
904
+ ],
905
+ [
906
+ 0.0,
907
+ 0.0,
908
+ 0.0,
909
+ 1.0
910
+ ]
911
+ ],
912
+ "rvec_w2c": [
913
+ -0.28912213588998953,
914
+ 1.5963056590146754,
915
+ -0.2906694025938897
916
+ ],
917
+ "tvec_w2c_mm": [
918
+ 931.2211238442036,
919
+ -2444.785053522505,
920
+ -123.46049179867488
921
+ ],
922
+ "position_mm": [
923
+ -951.4227472070256,
924
+ 2244.2097397499574,
925
+ -957.9700582817479
926
+ ],
927
+ "reproj": {
928
+ "train_mean_px": 3.475393358339814,
929
+ "train_median_px": 2.9746573817404833,
930
+ "test_mean_px": 5.838131593355678,
931
+ "test_median_px": 4.266213525838221,
932
+ "n_train_frames": 440,
933
+ "n_trimmed": 7,
934
+ "n_test_frames": 111,
935
+ "n_train_corners": 24092
936
+ }
937
+ }
938
+ }
939
+ }
Room-scale/calibration/scripts/visualize/requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ rerun-sdk>=0.26,<0.30
2
+ numpy>=1.26
3
+ opencv-python-headless>=4.9
4
+ PyYAML>=6.0
5
+ gradio>=5.0,<7
Room-scale/calibration/scripts/visualize/visualize_case.py ADDED
@@ -0,0 +1,567 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Visualize a synchronized ZED + Homie + OptiTrack/SMPL-X data case in Rerun."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import csv
8
+ import json
9
+ import os
10
+ import socket
11
+ import struct
12
+ import subprocess
13
+ import time
14
+ import xml.etree.ElementTree as ET
15
+ from pathlib import Path
16
+
17
+ import cv2
18
+ import numpy as np
19
+ import rerun as rr
20
+ import rerun.blueprint as rrb
21
+ import yaml
22
+
23
+ HERE = Path(__file__).resolve().parent
24
+ DEFAULT_CASE = Path("/mnt/Datasets/2026-06-27-12:26:35")
25
+ HOMIE_NAMES = ("front_left", "front_right", "back_left", "back_right")
26
+ HOMIE_VIDEO = {
27
+ "front_left": "homie_front_left.mp4",
28
+ "front_right": "homie_front_right.mp4",
29
+ "back_left": "homie_back_left.mp4",
30
+ "back_right": "homie_back_right.mp4",
31
+ }
32
+ HOMIE_CAMCHAIN = {
33
+ "front_left": "cam0", "front_right": "cam1",
34
+ "back_left": "cam2", "back_right": "cam3",
35
+ }
36
+
37
+
38
+ def parse_args() -> argparse.Namespace:
39
+ p = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
40
+ p.add_argument("case", nargs="?", type=Path, default=DEFAULT_CASE)
41
+ p.add_argument("--zed-calib", type=Path, default=HERE / "config/zed_poses_0622.json")
42
+ p.add_argument("--homie-calib", type=Path, default=HERE / "config/homie_rig_calib.json")
43
+ p.add_argument("--homie-camchain", type=Path, default=HERE / "config/homie-camchain.yaml")
44
+ p.add_argument("--zed", default="0,1,2,3,4,5,6,7", help="ZED camera indices, or empty")
45
+ p.add_argument("--homie", default="front_left", help="Homie camera names, or empty")
46
+ p.add_argument("--optitrack-calib", type=Path, default=HERE / "config/Calibration-Exported.mcal")
47
+ p.add_argument("--assets-dir", type=Path,
48
+ default=Path("/home/acerobotics/Datasets/mesh_alignmend/aligned_textured"),
49
+ help="room OBJ asset directory (flat *.obj or <name>/mesh.obj layout)")
50
+ p.add_argument("--no-room-assets", dest="no_room_assets", action="store_true", default=False,
51
+ help="do not load room assets")
52
+ p.add_argument("--room-assets", dest="no_room_assets", action="store_false",
53
+ help="explicitly enable room asset loading")
54
+ p.add_argument("--enable-room-alignment", dest="enable_room_alignment", action="store_true", default=True,
55
+ help="enable floor/center alignment and CLI room offsets (default)")
56
+ p.add_argument("--no-room-alignment", dest="enable_room_alignment", action="store_false",
57
+ help="disable floor/center alignment and CLI room offsets")
58
+ p.add_argument("--enable-room-controls", dest="enable_room_controls", action="store_true", default=True,
59
+ help="launch live room translation/rotation controls (default)")
60
+ p.add_argument("--no-room-controls", dest="enable_room_controls", action="store_false",
61
+ help="disable live room transform controls")
62
+ p.add_argument("--asset-floor-z", type=float, default=-1.62, help="floor Z in the source Z-up OBJ coordinates")
63
+ p.add_argument("--asset-translation", type=float, nargs=3, default=(0.12, -0.52, 0.79), metavar=("DX", "DY", "DZ"),
64
+ help="additional room translation in OptiTrack world meters")
65
+ p.add_argument("--asset-rotation-deg", type=float, nargs=3, default=(0.0, 62.0, 0.0), metavar=("RX", "RY", "RZ"),
66
+ help="additional room rotation about world X/Y/Z in degrees")
67
+ p.add_argument("--no-auto-asset-align", action="store_true", help="disable horizontal room/camera center alignment")
68
+ p.add_argument("--start", type=float, default=0.0, help="start time in OptiTrack seconds")
69
+ p.add_argument("--duration", type=float, default=None)
70
+ p.add_argument("--mesh-fps", type=float, default=15.0,
71
+ help="(unused; SMPL is logged as a single static pose at --start)")
72
+ p.add_argument("--no-video", action="store_true")
73
+ p.add_argument("--full-video", action="store_true", help="embed complete MP4 assets instead of one RGB frame per camera")
74
+ p.add_argument("--no-smpl", action="store_true")
75
+ p.add_argument("--save", type=Path, help="write an .rrd instead of spawning the viewer")
76
+ p.add_argument("--connect", metavar="URL", help="connect to an existing Rerun server, e.g. rerun+http://127.0.0.1:9876/proxy")
77
+ p.add_argument("--grpc-port", type=int, default=9876, help="Rerun data proxy port (only with --connect)")
78
+ p.add_argument("--web-port", type=int, default=9090, help="headless Web Viewer HTTP port")
79
+ p.add_argument("--control-port", type=int, default=None, help="room-alignment UI port; default web-port + 2")
80
+ p.add_argument("--server-memory", default="8GiB", help="Rerun proxy cache limit")
81
+ return p.parse_args()
82
+
83
+
84
+ def kill_orphaned_viewers() -> None:
85
+ """Terminate leftover rerun servers from previous runs of this script.
86
+
87
+ They are detached (start_new_session), so they outlive a crashed or
88
+ Ctrl+C'd parent and then squat on the ports. A process serving our own
89
+ /tmp/multicam_optitrack_smpl_*.rrd is killed unless some ancestor is a
90
+ still-running visualize_case.py (i.e. an active sibling session).
91
+ """
92
+ import signal
93
+
94
+ def ppid_of(pid: int) -> int:
95
+ try:
96
+ return int(Path(f"/proc/{pid}/stat").read_text().rsplit(")", 1)[1].split()[1])
97
+ except (OSError, IndexError, ValueError):
98
+ return 0
99
+
100
+ def has_live_owner(pid: int) -> bool:
101
+ seen = 0
102
+ while pid > 1 and seen < 20:
103
+ try:
104
+ argv = Path(f"/proc/{pid}/cmdline").read_bytes().split(b"\0")
105
+ except OSError:
106
+ return False
107
+ if pid != os.getpid() and any(a.endswith(b"visualize_case.py") for a in argv):
108
+ return True
109
+ pid, seen = ppid_of(pid), seen + 1
110
+ return False
111
+
112
+ for pid_dir in Path("/proc").glob("[0-9]*"):
113
+ pid = int(pid_dir.name)
114
+ if pid == os.getpid():
115
+ continue
116
+ try:
117
+ argv = (pid_dir / "cmdline").read_bytes().split(b"\0")
118
+ except OSError:
119
+ continue
120
+ # exact-argument match so shells whose command text merely quotes
121
+ # these strings are never touched
122
+ serves_our_rrd = any(a.startswith(b"/tmp/multicam_optitrack_smpl_")
123
+ and a.endswith(b".rrd") for a in argv)
124
+ if (serves_our_rrd and b"--serve-web" in argv
125
+ and not has_live_owner(pid)):
126
+ print(f"Stopping orphaned Rerun viewer (pid {pid})")
127
+ try:
128
+ os.kill(pid, signal.SIGTERM)
129
+ except OSError:
130
+ pass
131
+ time.sleep(0.5)
132
+
133
+
134
+ def start_headless_server(recording: Path, web_port: int, server_memory: str) -> subprocess.Popen:
135
+ """Start the web viewer on a completed RRD; no transient gRPC stream involved."""
136
+ executable = Path(__file__).resolve().parent / ".venv/bin/rerun"
137
+ if not executable.is_file():
138
+ raise FileNotFoundError(f"Rerun CLI not found at {executable}; install requirements in .venv")
139
+ with socket.socket() as check:
140
+ if check.connect_ex(("127.0.0.1", web_port)) == 0:
141
+ kill_orphaned_viewers()
142
+ with socket.socket() as check:
143
+ if check.connect_ex(("127.0.0.1", web_port)) == 0:
144
+ raise RuntimeError(f"Port {web_port} is already in use. Re-run with --web-port {web_port + 1}")
145
+ # Rerun's web app still fetches data through this proxy. Keep it predictable for SSH.
146
+ proxy_port = web_port + 1
147
+ with socket.socket() as check:
148
+ if check.connect_ex(("127.0.0.1", proxy_port)) == 0:
149
+ raise RuntimeError(f"Proxy port {proxy_port} is already in use. Choose another --web-port")
150
+ proc = subprocess.Popen(
151
+ [str(executable), str(recording), "--serve-web", "--bind", "127.0.0.1",
152
+ "--port", str(proxy_port), "--web-viewer-port", str(web_port),
153
+ "--server-memory-limit", server_memory],
154
+ start_new_session=True,
155
+ )
156
+ deadline = time.monotonic() + 15.0
157
+ while time.monotonic() < deadline:
158
+ if proc.poll() is not None:
159
+ raise RuntimeError("Rerun Web Viewer exited during startup; run .venv/bin/rerun --serve-web to inspect its error")
160
+ try:
161
+ with socket.create_connection(("127.0.0.1", web_port), timeout=0.2):
162
+ return proc
163
+ except OSError:
164
+ time.sleep(0.1)
165
+ proc.terminate()
166
+ raise TimeoutError(f"Rerun Web Viewer did not open port {web_port}")
167
+
168
+
169
+ def rotation_xyz_deg(rx: float, ry: float, rz: float) -> np.ndarray:
170
+ x, y, z = np.radians([rx, ry, rz])
171
+ cx, sx, cy, sy, cz, sz = np.cos(x), np.sin(x), np.cos(y), np.sin(y), np.cos(z), np.sin(z)
172
+ Rx = np.array([[1, 0, 0], [0, cx, -sx], [0, sx, cx]])
173
+ Ry = np.array([[cy, 0, sy], [0, 1, 0], [-sy, 0, cy]])
174
+ Rz = np.array([[cz, -sz, 0], [sz, cz, 0], [0, 0, 1]])
175
+ return Rz @ Ry @ Rx
176
+
177
+
178
+ def launch_alignment_ui(base_translation: np.ndarray, room_R: np.ndarray, proxy_port: int,
179
+ control_port: int, recording_id: str):
180
+ import gradio as gr
181
+ stream = rr.RecordingStream("multicam_optitrack_smpl", recording_id=recording_id)
182
+ stream.connect_grpc(f"rerun+http://127.0.0.1:{proxy_port}/proxy")
183
+
184
+ counter = [0]
185
+
186
+ def update(dx: float, dy: float, dz: float, rx: float, ry: float, rz: float) -> str:
187
+ delta = np.array([dx, dy, dz], float)
188
+ total = base_translation + delta
189
+ total_R = rotation_xyz_deg(rx, ry, rz) @ room_R
190
+ rr.log("world/room", rr.Transform3D(translation=total, mat3x3=total_R), static=True, recording=stream)
191
+ stream.flush()
192
+ counter[0] += 1
193
+ return (f"已发送更新 #{counter[0]}\n\n"
194
+ f"总平移: [{total[0]:.3f}, {total[1]:.3f}, {total[2]:.3f}] m "
195
+ f"附加旋转: [{rx:.1f}, {ry:.1f}, {rz:.1f}]°\n\n"
196
+ f"启动参数: `--asset-translation {dx:.3f} {dy:.3f} {dz:.3f} "
197
+ f"--asset-rotation-deg {rx:.1f} {ry:.1f} {rz:.1f}`")
198
+
199
+ with gr.Blocks(title="Room alignment") as demo:
200
+ gr.Markdown("# 房间 Mesh 平移���调\n滑块表示叠加在自动对齐结果上的偏移(米)。松开滑块后更新 Rerun。")
201
+ x = gr.Slider(-5, 5, value=0, step=0.01, label="X 平移 / m")
202
+ y = gr.Slider(-5, 5, value=0, step=0.01, label="Y 平移 / m")
203
+ z = gr.Slider(-5, 5, value=0, step=0.01, label="Z 平移 / m")
204
+ with gr.Row():
205
+ rx = gr.Slider(-180, 180, value=0, step=1, label="绕 X 旋转 / °")
206
+ ry = gr.Slider(-180, 180, value=0, step=1, label="绕 Y 旋转 / °")
207
+ rz = gr.Slider(-180, 180, value=0, step=1, label="绕 Z 旋转 / °")
208
+ controls = [x, y, z, rx, ry, rz]
209
+ status = gr.Markdown(update(0, 0, 0, 0, 0, 0))
210
+ for slider in controls:
211
+ slider.release(update, inputs=controls, outputs=status, show_progress="hidden")
212
+ gr.Button("应用数值", variant="primary").click(update, inputs=controls, outputs=status, show_progress="hidden")
213
+ demo.launch(server_name="127.0.0.1", server_port=control_port, prevent_thread_lock=True, quiet=True)
214
+ return demo, stream
215
+
216
+
217
+ def load_obj(path: Path) -> tuple[np.ndarray, np.ndarray]:
218
+ vertices, faces = [], []
219
+ with path.open() as f:
220
+ for line in f:
221
+ if line.startswith("v "):
222
+ vertices.append([float(x) for x in line.split()[1:4]])
223
+ elif line.startswith("f "):
224
+ idx = [int(x.split("/")[0]) - 1 for x in line.split()[1:]]
225
+ for i in range(1, len(idx) - 1):
226
+ faces.append([idx[0], idx[i], idx[i + 1]])
227
+ return np.asarray(vertices, np.float32), np.asarray(faces, np.uint32)
228
+
229
+
230
+ def obj_collection_bounds(paths: list[Path]) -> tuple[np.ndarray, np.ndarray]:
231
+ lo, hi = np.full(3, np.inf), np.full(3, -np.inf)
232
+ for path in paths:
233
+ with path.open(errors="ignore") as f:
234
+ for line in f:
235
+ if line.startswith("v "):
236
+ v = np.fromstring(line[2:], sep=" ", count=3)
237
+ if len(v) == 3:
238
+ lo, hi = np.minimum(lo, v), np.maximum(hi, v)
239
+ if not np.isfinite(lo).all():
240
+ raise ValueError("No OBJ vertices found for room alignment")
241
+ return lo, hi
242
+
243
+
244
+ def open_pc2(path: Path) -> tuple[np.memmap, float]:
245
+ with path.open("rb") as f:
246
+ if f.read(12) != b"POINTCACHE2\0":
247
+ raise ValueError(f"Not a POINTCACHE2 file: {path}")
248
+ version, points, start, rate, frames = struct.unpack("<iiffi", f.read(20))
249
+ if version != 1 or path.stat().st_size != 32 + frames * points * 12:
250
+ raise ValueError(f"Invalid PC2 header/size: {path}")
251
+ return np.memmap(path, dtype="<f4", mode="r", offset=32, shape=(frames, points, 3)), rate
252
+
253
+
254
+ def read_homie_poses(path: Path) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
255
+ data = np.genfromtxt(path, delimiter=",", names=True, skip_header=1)
256
+ frames = data["frame"].astype(np.int64)
257
+ pos_m = np.column_stack([data["Homie_px"], data["Homie_py"], data["Homie_pz"]]) / 1000.0
258
+ quat = np.column_stack([data["Homie_qx"], data["Homie_qy"], data["Homie_qz"], data["Homie_qw"]])
259
+ return frames, pos_m, quat
260
+
261
+
262
+ def quat_xyzw_to_mat(q: np.ndarray) -> np.ndarray:
263
+ q = q / np.linalg.norm(q)
264
+ x, y, z, w = q
265
+ return np.array([
266
+ [1-2*(y*y+z*z), 2*(x*y-z*w), 2*(x*z+y*w)],
267
+ [2*(x*y+z*w), 1-2*(x*x+z*z), 2*(y*z-x*w)],
268
+ [2*(x*z-y*w), 2*(y*z+x*w), 1-2*(x*x+y*y)],
269
+ ])
270
+
271
+
272
+ def euler_rotation(pitch: float, yaw: float, roll: float) -> np.ndarray:
273
+ p, y, r = np.radians([pitch, yaw, roll])
274
+ cp, sp, cy, sy, cr, sr = np.cos(p), np.sin(p), np.cos(y), np.sin(y), np.cos(r), np.sin(r)
275
+ return np.array([[cr*cy, cr*sy*sp-sr*cp, cr*sy*cp+sr*sp],
276
+ [sr*cy, sr*sy*sp+cr*cp, sr*sy*cp-cr*sp],
277
+ [-sy, cy*sp, cy*cp]])
278
+
279
+
280
+ def homie_rectification(camchain_path: Path) -> tuple[dict[str, np.ndarray], np.ndarray]:
281
+ cc = yaml.safe_load(camchain_path.read_text())
282
+ # Matches the parameters recorded in this case's rectify_report.json.
283
+ out, fov, zoom = 1024, 90.0, 0.78125
284
+ focal = out / (2 * np.tan(np.radians(fov) / 2)) * zoom
285
+ K = np.array([[focal, 0, out/2], [0, focal, out/2], [0, 0, 1.0]])
286
+ view = euler_rotation(-5.0, 0.0, 0.0)
287
+ result = {}
288
+ pairs = (("cam0", "front_left", "cam1", "front_right"),
289
+ ("cam2", "back_left", "cam3", "back_right"))
290
+ for lk, ln, rk, rn in pairs:
291
+ def kd(key: str):
292
+ c = cc[key]; fx, fy, cx, cy = c["intrinsics"]
293
+ return np.array([[fx, 0, cx], [0, fy, cy], [0, 0, 1.0]]), np.asarray(c["distortion_coeffs"])
294
+ K0, D0 = kd(lk); K1, D1 = kd(rk)
295
+ T = np.asarray(cc[rk]["T_cn_cnm1"], float)
296
+ size = tuple(map(int, cc[lk]["resolution"]))
297
+ R1, R2, *_ = cv2.fisheye.stereoRectify(K0, D0, K1, D1, size, T[:3, :3], T[:3, 3],
298
+ flags=cv2.CALIB_ZERO_DISPARITY, newImageSize=size,
299
+ balance=0.0, fov_scale=1.0)
300
+ result[ln], result[rn] = view @ R1, view @ R2
301
+ return result, K
302
+
303
+
304
+ def log_video(path: str, video_path: Path, origin_s: float) -> None:
305
+ asset = rr.AssetVideo(path=video_path)
306
+ rr.log(path, asset, static=True)
307
+ stamps = asset.read_frame_timestamps_nanos()
308
+ rr.send_columns(path,
309
+ indexes=[rr.TimeColumn("time", duration=origin_s + stamps * 1e-9)],
310
+ columns=rr.VideoFrameReference.columns_nanos(stamps))
311
+
312
+
313
+ def log_video_frame(path: str, video_path: Path, origin_s: float, requested_time_s: float,
314
+ flip_vertical: bool = False) -> None:
315
+ """Log one JPEG frame, avoiding transfer of the complete MP4 asset."""
316
+ sample_time = max(requested_time_s, origin_s)
317
+ cap = cv2.VideoCapture(str(video_path))
318
+ cap.set(cv2.CAP_PROP_POS_MSEC, max(0.0, sample_time - origin_s) * 1000.0)
319
+ ok, frame = cap.read()
320
+ cap.release()
321
+ if not ok:
322
+ raise RuntimeError(f"Could not decode RGB frame from {video_path} at {sample_time - origin_s:.3f}s")
323
+ if flip_vertical:
324
+ frame = cv2.flip(frame, 0)
325
+ ok, encoded = cv2.imencode(".jpg", frame, [cv2.IMWRITE_JPEG_QUALITY, 90])
326
+ if not ok:
327
+ raise RuntimeError(f"Could not JPEG-encode frame from {video_path}")
328
+ rr.set_time("time", duration=sample_time)
329
+ rr.log(path, rr.EncodedImage(contents=encoded.tobytes(), media_type="image/jpeg"))
330
+
331
+
332
+ def rotation_midpoint(a: np.ndarray, b: np.ndarray) -> np.ndarray:
333
+ """Closest proper rotation to the equal-weight mean of two rotations."""
334
+ u, _, vt = np.linalg.svd(a + b)
335
+ d = np.eye(3); d[-1, -1] = np.linalg.det(u @ vt)
336
+ return u @ d @ vt
337
+
338
+
339
+ def load_optitrack_cameras(path: Path) -> dict[int, dict]:
340
+ root = ET.fromstring(path.read_bytes().decode("utf-16"))
341
+ gl_to_cv = np.diag([1.0, -1.0, -1.0])
342
+ cameras = {}
343
+ for cam in root.findall(".//Camera"):
344
+ props, intr, extr = cam.find("Properties"), cam.find("IntrinsicStandardCameraModel"), cam.find("Extrinsic")
345
+ if props is None or intr is None or extr is None:
346
+ continue
347
+ cid = int(props.attrib["CameraID"])
348
+ fx, fy = float(intr.attrib["HorizontalFocalLength"]), float(intr.attrib["VerticalFocalLength"])
349
+ cx, cy = float(intr.attrib["LensCenterX"]), float(intr.attrib["LensCenterY"])
350
+ R = np.array([float(extr.attrib[f"OrientMatrix{i}"]) for i in range(9)]).reshape(3, 3) @ gl_to_cv
351
+ t = np.array([float(extr.attrib[k]) for k in ("X", "Y", "Z")]) * 1000.0
352
+ T = np.eye(4); T[:3, :3], T[:3, 3] = R, t
353
+ cameras[cid] = {"T_c2w": T, "K": np.array([[fx, 0, cx], [0, fy, cy], [0, 0, 1.0]]),
354
+ "width": 2048, "height": 1088, "serial": cam.attrib.get("Serial", "")}
355
+ return cameras
356
+
357
+
358
+ def log_camera_static(path: str, T_c2w: np.ndarray, K: np.ndarray, width: int, height: int,
359
+ color: tuple[int, int, int]) -> None:
360
+ rr.log(path, rr.Transform3D(translation=T_c2w[:3, 3] / 1000.0, mat3x3=T_c2w[:3, :3]), static=True)
361
+ rr.log(path, rr.Pinhole(image_from_camera=K, width=width, height=height,
362
+ camera_xyz=rr.ViewCoordinates.RDF, image_plane_distance=0.32,
363
+ color=color), static=True)
364
+
365
+
366
+ def blueprint(zed: list[str], homie: list[str]) -> rrb.Blueprint:
367
+ video_views = [rrb.Spatial2DView(name=f"ZED {c}", origin=f"world/cameras/zed/cam{c}") for c in zed]
368
+ video_views += [rrb.Spatial2DView(name=f"Homie {c}", origin=f"world/cameras/homie/{c}") for c in homie]
369
+ videos = rrb.Grid(*video_views, grid_columns=2) if video_views else rrb.TextLogView()
370
+ return rrb.Blueprint(rrb.Horizontal(
371
+ rrb.Spatial3DView(name="All cameras + SMPL", origin="world", contents=["world/**"],
372
+ background=[41, 43, 38]), # matches calibration_sz.png backdrop
373
+ videos, column_shares=[2, 1]), collapse_panels=True)
374
+
375
+
376
+ def main() -> None:
377
+ args = parse_args(); case = args.case.resolve()
378
+ server_proc = None
379
+ alignment_ui = alignment_stream = None
380
+ room_base_translation = room_rotation = None
381
+ recording_id = "multicam-optitrack-smpl-room-control"
382
+ web_rrd = None
383
+ zed_ids = [x.strip() for x in args.zed.split(",") if x.strip()]
384
+ homie_ids = [x.strip() for x in args.homie.split(",") if x.strip()]
385
+ unknown = set(homie_ids) - set(HOMIE_NAMES)
386
+ if unknown: raise ValueError(f"Unknown Homie cameras: {sorted(unknown)}")
387
+ if args.save and args.connect:
388
+ raise ValueError("--save and --connect are mutually exclusive")
389
+ rr.init("multicam_optitrack_smpl", recording_id=recording_id, spawn=False)
390
+ if args.save:
391
+ rr.save(args.save)
392
+ elif args.connect:
393
+ rr.connect_grpc(args.connect)
394
+ else:
395
+ web_rrd = Path(f"/tmp/multicam_optitrack_smpl_{os.getpid()}.rrd")
396
+ rr.save(web_rrd)
397
+ rr.log("world", rr.ViewCoordinates.RIGHT_HAND_Y_UP, static=True)
398
+ rr.log("world/origin", rr.TransformAxes3D(axis_length=0.5), static=True)
399
+
400
+ zc = json.loads(args.zed_calib.read_text())["cameras"]
401
+
402
+ if not args.no_room_assets and args.assets_dir.is_dir():
403
+ # Source meshes are globally placed in a Z-up reconstruction. Convert
404
+ # (x,y,z)_src -> (x,z,-y)_world and lift their source floor to Y=0.
405
+ axis_R = np.array([[1, 0, 0], [0, 0, 1], [0, -1, 0]], dtype=float)
406
+ room_R = axis_R.copy()
407
+ excluded_assets = {"scene.obj", "table_cook.obj"}
408
+ # New layout: aligned_textured/<name>/mesh.glb (textures embedded;
409
+ # Asset3D cannot resolve an OBJ's external .mtl/.png). Fall back to
410
+ # <name>/mesh.obj, then to the legacy flat *.obj layout.
411
+ parts = sorted(args.assets_dir.glob("*/mesh.glb"))
412
+ if not parts:
413
+ parts = sorted(args.assets_dir.glob("*/mesh.obj"))
414
+ if not parts:
415
+ parts = sorted(p for p in args.assets_dir.glob("*.obj") if p.name not in excluded_assets)
416
+ objects = parts
417
+ translation = np.zeros(3)
418
+ if args.enable_room_alignment:
419
+ room_R = rotation_xyz_deg(*args.asset_rotation_deg) @ axis_R
420
+ translation = np.array([0.0, -args.asset_floor_z, 0.0]) + np.asarray(args.asset_translation)
421
+ if args.enable_room_alignment and objects and not args.no_auto_asset_align:
422
+ # bounds parser reads OBJ text; GLB entries use their sibling OBJ
423
+ bounds_paths = [p.with_suffix(".obj") if p.suffix == ".glb" else p for p in objects]
424
+ lo, hi = obj_collection_bounds(bounds_paths)
425
+ room_center_world = room_R @ ((lo + hi) * 0.5)
426
+ camera_positions = np.array([np.asarray(c["T_c2w"], float)[:3, 3] / 1000.0 for c in zc.values()])
427
+ camera_center = (camera_positions.min(axis=0) + camera_positions.max(axis=0)) * 0.5
428
+ translation[[0, 2]] += camera_center[[0, 2]] - room_center_world[[0, 2]]
429
+ print(f"Auto room alignment translation: {translation.round(3).tolist()} m")
430
+ rr.log("world/room", rr.Transform3D(translation=translation, mat3x3=room_R), static=True)
431
+ if args.enable_room_controls:
432
+ room_base_translation, room_rotation = translation.copy(), room_R.copy()
433
+ palette = [(230, 92, 92), (239, 158, 64), (230, 205, 80), (86, 190, 116),
434
+ (65, 185, 205), (78, 135, 225), (145, 105, 210), (215, 95, 175),
435
+ (155, 115, 82), (120, 175, 155)]
436
+ for i, obj in enumerate(objects):
437
+ # <name>/mesh.glb|obj carries its own texture: log untinted.
438
+ # Legacy untextured flat OBJs keep the palette tint.
439
+ textured = obj.name in ("mesh.glb", "mesh.obj")
440
+ name = obj.parent.name if textured else obj.stem
441
+ if textured:
442
+ rr.log(f"world/room/objects/{name}", rr.Asset3D(path=obj), static=True)
443
+ else:
444
+ rr.log(f"world/room/objects/{name}",
445
+ rr.Asset3D(path=obj, albedo_factor=palette[i % len(palette)]), static=True)
446
+
447
+ zed_color = (60, 220, 90)
448
+ for cid in zed_ids:
449
+ c = zc[cid]; path = f"world/cameras/zed/cam{cid}"
450
+ log_camera_static(path, np.asarray(c["T_c2w"]), np.asarray(c["K"]), c["width"], c["height"], zed_color)
451
+
452
+ for cid, c in load_optitrack_cameras(args.optitrack_calib).items():
453
+ log_camera_static(f"world/cameras/optitrack/cam{cid}", c["T_c2w"], c["K"], c["width"], c["height"], (65, 135, 255))
454
+
455
+ rig = json.loads(args.homie_calib.read_text())["T_homie_cam"]
456
+ Rrect, Kh = homie_rectification(args.homie_camchain)
457
+ frames, positions, quats = read_homie_poses(case / "objects/rb_Homie.csv")
458
+ end = np.inf if args.duration is None else args.start + args.duration
459
+
460
+ def homie_cam_T(Twh: np.ndarray, cam: str) -> np.ndarray:
461
+ if cam == "front_left":
462
+ Tl = Twh @ np.asarray(rig["front_left"], float)
463
+ Tr = Twh @ np.asarray(rig["front_right"], float)
464
+ Tl[:3, :3] = Tl[:3, :3] @ Rrect["front_left"].T
465
+ Tr[:3, :3] = Tr[:3, :3] @ Rrect["front_right"].T
466
+ T = np.eye(4)
467
+ T[:3, 3] = (Tl[:3, 3] + Tr[:3, 3]) * 0.5
468
+ T[:3, :3] = rotation_midpoint(Tl[:3, :3], Tr[:3, :3])
469
+ return T
470
+ T = Twh @ np.asarray(rig[cam], float)
471
+ T[:3, :3] = T[:3, :3] @ Rrect[cam].T
472
+ return T
473
+
474
+ if args.full_video:
475
+ # animated rig: poses follow the timeline alongside the videos
476
+ keep = (frames / 60.0 >= args.start) & (frames / 60.0 <= end)
477
+ for frame, pos, quat in zip(frames[keep], positions[keep], quats[keep]):
478
+ rr.set_time("time", duration=float(frame) / 60.0)
479
+ Rwh = quat_xyzw_to_mat(quat)
480
+ rr.log("world/optitrack/homie_rigid_body", rr.Transform3D(translation=pos, mat3x3=Rwh))
481
+ rr.log("world/optitrack/homie_rigid_body", rr.TransformAxes3D(axis_length=0.25))
482
+ Twh = np.eye(4); Twh[:3, :3], Twh[:3, 3] = Rwh, pos * 1000.0
483
+ for cam in homie_ids:
484
+ T = homie_cam_T(Twh, cam)
485
+ rr.log(f"world/cameras/homie/{cam}", rr.Transform3D(translation=T[:3, 3]/1000.0, mat3x3=T[:3, :3]))
486
+ else:
487
+ # static snapshot at --start, consistent with the static human and the
488
+ # single logged video frames
489
+ i = int(np.argmin(np.abs(frames / 60.0 - args.start)))
490
+ Rwh = quat_xyzw_to_mat(quats[i])
491
+ rr.log("world/optitrack/homie_rigid_body",
492
+ rr.Transform3D(translation=positions[i], mat3x3=Rwh), static=True)
493
+ rr.log("world/optitrack/homie_rigid_body", rr.TransformAxes3D(axis_length=0.25), static=True)
494
+ Twh = np.eye(4); Twh[:3, :3], Twh[:3, 3] = Rwh, positions[i] * 1000.0
495
+ for cam in homie_ids:
496
+ T = homie_cam_T(Twh, cam)
497
+ rr.log(f"world/cameras/homie/{cam}",
498
+ rr.Transform3D(translation=T[:3, 3]/1000.0, mat3x3=T[:3, :3]), static=True)
499
+ for cam in homie_ids:
500
+ rr.log(f"world/cameras/homie/{cam}", rr.Pinhole(image_from_camera=Kh, width=1024, height=1024,
501
+ camera_xyz=rr.ViewCoordinates.RDF, image_plane_distance=0.24, color=(255, 105, 55)), static=True)
502
+
503
+ if not args.no_video:
504
+ export = json.loads((case / "videos/export_info.json").read_text())
505
+ origins = {v["file"]: float(v["start_optitrack_time_s"]) for v in export["videos"]}
506
+ for cid in zed_ids:
507
+ name = f"zed_cam{cid}.mp4"; path = f"world/cameras/zed/cam{cid}/rgb"
508
+ if args.full_video: log_video(path, case/"videos"/name, origins[name])
509
+ else: log_video_frame(path, case/"videos"/name, origins[name], args.start, flip_vertical=True)
510
+ for cam in homie_ids:
511
+ name = HOMIE_VIDEO[cam]; path = f"world/cameras/homie/{cam}/rgb"
512
+ if args.full_video: log_video(path, case/"videos"/name, origins[name])
513
+ else: log_video_frame(path, case/"videos"/name, origins[name], args.start)
514
+
515
+ if not args.no_smpl:
516
+ # Static single pose at --start: the Homie rig does not follow the
517
+ # human, so animating the SMPL mesh only inflates the recording.
518
+ _, faces = load_obj(case / "viz/human/poses_template.obj")
519
+ verts, source_fps = open_pc2(case / "viz/human/poses_motion.pc2")
520
+ i = min(len(verts) - 1, max(0, int(round(args.start * source_fps))))
521
+ rr.log("world/human/smplx", rr.Mesh3D(vertex_positions=verts[i], triangle_indices=faces,
522
+ vertex_colors=(115, 170, 255, 210)), static=True)
523
+ rr.send_blueprint(blueprint(zed_ids, homie_ids))
524
+ print("Rerun logging complete.")
525
+ if web_rrd is not None:
526
+ rr.disconnect()
527
+ server_proc = start_headless_server(web_rrd, args.web_port, args.server_memory)
528
+ print(f"Headless Web Viewer loaded {web_rrd}.")
529
+ proxy_port = args.web_port + 1
530
+ control_port = args.control_port
531
+ if control_port is None: # first free port from web_port+2
532
+ for candidate in range(args.web_port + 2, args.web_port + 22):
533
+ with socket.socket() as check:
534
+ if check.connect_ex(("127.0.0.1", candidate)) != 0:
535
+ control_port = candidate
536
+ break
537
+ else:
538
+ raise RuntimeError("No free control port found; pass --control-port")
539
+ if room_base_translation is not None:
540
+ alignment_ui, alignment_stream = launch_alignment_ui(
541
+ room_base_translation, room_rotation, proxy_port, control_port, recording_id)
542
+ print("On your LOCAL machine run:")
543
+ forwards = f"-L {args.web_port}:127.0.0.1:{args.web_port} -L {proxy_port}:127.0.0.1:{proxy_port}"
544
+ if alignment_ui is not None:
545
+ forwards += f" -L {control_port}:127.0.0.1:{control_port}"
546
+ print(f" ssh -N {forwards} acerobotics@SERVER")
547
+ print("Then open:")
548
+ print(f" http://127.0.0.1:{args.web_port}?url=rerun%3A%2F%2Flocalhost%3A{proxy_port}%2Fproxy")
549
+ if alignment_ui is not None:
550
+ print(f"Room alignment controls: http://127.0.0.1:{control_port}")
551
+ if server_proc is not None:
552
+ print("Web Viewer is ready. Keep this process running; press Ctrl+C after viewing.")
553
+ try:
554
+ server_proc.wait()
555
+ except KeyboardInterrupt:
556
+ print("\nStopping Web Viewer...")
557
+ if alignment_ui is not None:
558
+ alignment_ui.close()
559
+ server_proc.terminate()
560
+ try:
561
+ server_proc.wait(timeout=5)
562
+ except subprocess.TimeoutExpired:
563
+ server_proc.kill()
564
+
565
+
566
+ if __name__ == "__main__":
567
+ main()
Room-scale/calibration/zed_intrinsics.json ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "0": {
3
+ "K": [
4
+ [
5
+ 736.3110,
6
+ 0.0,
7
+ 967.3720
8
+ ],
9
+ [
10
+ 0.0,
11
+ 735.8380,
12
+ 488.6960
13
+ ],
14
+ [
15
+ 0.0,
16
+ 0.0,
17
+ 1.0
18
+ ]
19
+ ],
20
+ "dist": [
21
+ 0.1236,
22
+ 0.0684,
23
+ 0.0003,
24
+ -0.0002,
25
+ -0.0415,
26
+ 0.1238,
27
+ 0.1235,
28
+ -0.0557
29
+ ],
30
+ "focal": 2.2089,
31
+ "width": 1920,
32
+ "height": 1080
33
+ },
34
+ "1": {
35
+ "K": [
36
+ [
37
+ 737.2930,
38
+ 0.0,
39
+ 941.3670
40
+ ],
41
+ [
42
+ 0.0,
43
+ 736.8900,
44
+ 540.6940
45
+ ],
46
+ [
47
+ 0.0,
48
+ 0.0,
49
+ 1.0
50
+ ]
51
+ ],
52
+ "dist": [
53
+ 0.1276,
54
+ 0.0680,
55
+ 0.0003,
56
+ -0.0002,
57
+ -0.0468,
58
+ 0.1284,
59
+ 0.1239,
60
+ -0.0618
61
+ ],
62
+ "focal": 2.2119,
63
+ "width": 1920,
64
+ "height": 1080
65
+ },
66
+ "2": {
67
+ "K": [
68
+ [
69
+ 737.5870,
70
+ 0.0,
71
+ 959.5190
72
+ ],
73
+ [
74
+ 0.0,
75
+ 737.0550,
76
+ 522.6710
77
+ ],
78
+ [
79
+ 0.0,
80
+ 0.0,
81
+ 1.0
82
+ ]
83
+ ],
84
+ "dist": [
85
+ 0.0308,
86
+ 0.0122,
87
+ 0.0004,
88
+ -0.0001,
89
+ -0.0083,
90
+ 0.0405,
91
+ 0.0504,
92
+ -0.0177
93
+ ],
94
+ "focal": 2.2128,
95
+ "width": 1920,
96
+ "height": 1080
97
+ },
98
+ "3": {
99
+ "K": [
100
+ [
101
+ 737.2120,
102
+ 0.0,
103
+ 944.6280
104
+ ],
105
+ [
106
+ 0.0,
107
+ 736.7870,
108
+ 527.4200
109
+ ],
110
+ [
111
+ 0.0,
112
+ 0.0,
113
+ 1.0
114
+ ]
115
+ ],
116
+ "dist": [
117
+ 0.1187,
118
+ 0.0765,
119
+ 0.0006,
120
+ -0.0003,
121
+ -0.0486,
122
+ 0.1190,
123
+ 0.1331,
124
+ -0.0638
125
+ ],
126
+ "focal": 2.2116,
127
+ "width": 1920,
128
+ "height": 1080
129
+ },
130
+ "4": {
131
+ "K": [
132
+ [
133
+ 737.4650,
134
+ 0.0,
135
+ 945.4760
136
+ ],
137
+ [
138
+ 0.0,
139
+ 737.0470,
140
+ 517.9350
141
+ ],
142
+ [
143
+ 0.0,
144
+ 0.0,
145
+ 1.0
146
+ ]
147
+ ],
148
+ "dist": [
149
+ 0.1174,
150
+ 0.0709,
151
+ 0.0004,
152
+ -0.0003,
153
+ -0.0456,
154
+ 0.1168,
155
+ 0.1266,
156
+ -0.0605
157
+ ],
158
+ "focal": 2.2124,
159
+ "width": 1920,
160
+ "height": 1080
161
+ },
162
+ "5": {
163
+ "K": [
164
+ [
165
+ 737.3020,
166
+ 0.0,
167
+ 952.8880
168
+ ],
169
+ [
170
+ 0.0,
171
+ 736.7300,
172
+ 526.6170
173
+ ],
174
+ [
175
+ 0.0,
176
+ 0.0,
177
+ 1.0
178
+ ]
179
+ ],
180
+ "dist": [
181
+ 0.0332,
182
+ 0.0126,
183
+ 0.0007,
184
+ -0.0004,
185
+ -0.0085,
186
+ 0.0437,
187
+ 0.0496,
188
+ -0.0174
189
+ ],
190
+ "focal": 2.2119,
191
+ "width": 1920,
192
+ "height": 1080
193
+ },
194
+ "6": {
195
+ "K": [
196
+ [
197
+ 739.3870,
198
+ 0.0,
199
+ 961.2400
200
+ ],
201
+ [
202
+ 0.0,
203
+ 738.9410,
204
+ 549.4950
205
+ ],
206
+ [
207
+ 0.0,
208
+ 0.0,
209
+ 1.0
210
+ ]
211
+ ],
212
+ "dist": [
213
+ 0.0276,
214
+ 0.0066,
215
+ 0.0002,
216
+ -0.0001,
217
+ -0.0067,
218
+ 0.0367,
219
+ 0.0447,
220
+ -0.0162
221
+ ],
222
+ "focal": 2.2182,
223
+ "width": 1920,
224
+ "height": 1080
225
+ },
226
+ "7": {
227
+ "K": [
228
+ [
229
+ 733.9870,
230
+ 0.0,
231
+ 934.0210
232
+ ],
233
+ [
234
+ 0.0,
235
+ 733.4570,
236
+ 520.8340
237
+ ],
238
+ [
239
+ 0.0,
240
+ 0.0,
241
+ 1.0
242
+ ]
243
+ ],
244
+ "dist": [
245
+ 0.1232,
246
+ 0.0888,
247
+ 0.0004,
248
+ -0.0000,
249
+ -0.0489,
250
+ 0.1256,
251
+ 0.1456,
252
+ -0.0637
253
+ ],
254
+ "focal": 2.2020,
255
+ "width": 1920,
256
+ "height": 1080
257
+ }
258
+ }
Room-scale/calibration/zed_poses_0622.json ADDED
@@ -0,0 +1,939 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "meta": {
3
+ "world_frame": "OptiTrack Motive world (Y-up, mm), identical to the Motive CSV export and the .mcal extrinsics",
4
+ "convention": "T_c2w: camera\u2192world, X_w = R@X_c + t (OpenCV camera axes: +Z forward, +X right, +Y down). Units: mm.",
5
+ "board": {
6
+ "tag_size_mm": 125.0,
7
+ "tag_gap_mm": 25.0,
8
+ "grid": 4,
9
+ "dict": "DICT_6X6_100"
10
+ },
11
+ "board_pose_source": "markers",
12
+ "n_ir_verified_poses": 3882,
13
+ "n_board_poses": 20258,
14
+ "ir_reproj_median_px": 7.548271327933806,
15
+ "marker_dist_p50_mm": 39.12134911198805,
16
+ "marker_offsets_board_mm": [
17
+ [
18
+ -288.62159175255556,
19
+ -291.06153400015074,
20
+ 25.133356793384934
21
+ ],
22
+ [
23
+ -290.1209460605521,
24
+ 294.3529408890757,
25
+ 26.390675068946763
26
+ ],
27
+ [
28
+ 298.1737594059931,
29
+ -290.8108225513729,
30
+ 25.0169032934206
31
+ ],
32
+ [
33
+ 299.03794657445195,
34
+ 297.11916556598663,
35
+ 22.719542171416467
36
+ ]
37
+ ],
38
+ "inputs": {
39
+ "mcal": "Calibration-Exported.mcal",
40
+ "zed_intrinsics": "zed_intrinsics.json",
41
+ "optitrack_dir": "/home/acerobotics/Videos/Calibration_Board_0610_OTE",
42
+ "zed_dir": "/home/acerobotics/Videos/Calibration_Board_0610_ZED/frames_synsplice_tmp",
43
+ "timestamps": "/home/acerobotics/Videos/Calibration_Board_0610_ZED/timestamps_opt.csv",
44
+ "optitrack_csv": "/home/acerobotics/Videos/Calibration_Board_0610/Calibration_Board_0610.csv",
45
+ "output": "zed_poses_in_optitrack.json",
46
+ "zed_cameras": "None",
47
+ "max_frames": "20000",
48
+ "workers": "None",
49
+ "subpix": "False",
50
+ "ir_gamma": "3.0",
51
+ "min_markers": "2",
52
+ "min_cams": "3",
53
+ "max_reproj_cam": "25.0",
54
+ "max_reproj_frame": "12.0",
55
+ "max_angle_gap": "360.0",
56
+ "marker_tol": "150.0",
57
+ "keep_unverified": "False",
58
+ "max_board_speed": "50.0",
59
+ "board_pose_source": "markers",
60
+ "marker_fit_tol": "10.0",
61
+ "max_sync_diff_ms": "8.0",
62
+ "max_reproj_zed": "4.0",
63
+ "max_corner_radius": "700.0",
64
+ "huber_delta": "5.0",
65
+ "trim_ratio": "3.0",
66
+ "test_fraction": "0.2",
67
+ "joint_rounds": "3",
68
+ "ir_weight": "0.1",
69
+ "marker_weight": "2.0",
70
+ "refine_offsets": "True"
71
+ }
72
+ },
73
+ "cameras": {
74
+ "0": {
75
+ "K": [
76
+ [
77
+ 736.311,
78
+ 0.0,
79
+ 967.372
80
+ ],
81
+ [
82
+ 0.0,
83
+ 735.838,
84
+ 488.696
85
+ ],
86
+ [
87
+ 0.0,
88
+ 0.0,
89
+ 1.0
90
+ ]
91
+ ],
92
+ "dist": [
93
+ 0.1236,
94
+ 0.0684,
95
+ 0.0003,
96
+ -0.0002,
97
+ -0.0415,
98
+ 0.1238,
99
+ 0.1235,
100
+ -0.0557
101
+ ],
102
+ "width": 1920,
103
+ "height": 1080,
104
+ "T_c2w": [
105
+ [
106
+ 0.8264854337212932,
107
+ 0.17858117294725595,
108
+ 0.5338825643484792,
109
+ -4498.1092102048615
110
+ ],
111
+ [
112
+ 0.04814999502482596,
113
+ 0.9224529420283858,
114
+ -0.3830954812083858,
115
+ 1740.7154835801487
116
+ ],
117
+ [
118
+ -0.5608951825659008,
119
+ 0.34232927776040095,
120
+ 0.7537952372908755,
121
+ -3855.1695492073027
122
+ ],
123
+ [
124
+ 0.0,
125
+ 0.0,
126
+ 0.0,
127
+ 1.0
128
+ ]
129
+ ],
130
+ "T_w2c": [
131
+ [
132
+ 0.8264854337212932,
133
+ 0.04814999502482596,
134
+ -0.5608951825659008,
135
+ 1471.4602715227556
136
+ ],
137
+ [
138
+ 0.17858117294725595,
139
+ 0.9224529420283858,
140
+ 0.34232927776040095,
141
+ 517.2869071643931
142
+ ],
143
+ [
144
+ 0.5338825643484792,
145
+ -0.3830954812083858,
146
+ 0.7537952372908755,
147
+ 5974.330760833986
148
+ ],
149
+ [
150
+ 0.0,
151
+ 0.0,
152
+ 0.0,
153
+ 1.0
154
+ ]
155
+ ],
156
+ "rvec_w2c": [
157
+ -0.3961210670788421,
158
+ -0.5978077312089015,
159
+ 0.0712224620681941
160
+ ],
161
+ "tvec_w2c_mm": [
162
+ 1471.4602715227556,
163
+ 517.2869071643931,
164
+ 5974.330760833986
165
+ ],
166
+ "position_mm": [
167
+ -4498.1092102048615,
168
+ 1740.7154835801487,
169
+ -3855.1695492073027
170
+ ],
171
+ "reproj": {
172
+ "train_mean_px": 1.7207454360764707,
173
+ "train_median_px": 1.4519597739379129,
174
+ "test_mean_px": 2.354627349748447,
175
+ "test_median_px": 2.098143603810553,
176
+ "n_train_frames": 180,
177
+ "n_trimmed": 6,
178
+ "n_test_frames": 47,
179
+ "n_train_corners": 6052
180
+ }
181
+ },
182
+ "1": {
183
+ "K": [
184
+ [
185
+ 737.293,
186
+ 0.0,
187
+ 941.367
188
+ ],
189
+ [
190
+ 0.0,
191
+ 736.89,
192
+ 540.694
193
+ ],
194
+ [
195
+ 0.0,
196
+ 0.0,
197
+ 1.0
198
+ ]
199
+ ],
200
+ "dist": [
201
+ 0.1276,
202
+ 0.068,
203
+ 0.0003,
204
+ -0.0002,
205
+ -0.0468,
206
+ 0.1284,
207
+ 0.1239,
208
+ -0.0618
209
+ ],
210
+ "width": 1920,
211
+ "height": 1080,
212
+ "T_c2w": [
213
+ [
214
+ -0.1273677302838765,
215
+ 0.5611442706308235,
216
+ 0.817859748869288,
217
+ -3086.3578269629165
218
+ ],
219
+ [
220
+ 0.02898380564134284,
221
+ 0.8263289974884052,
222
+ -0.5624413986544308,
223
+ 1595.3929826393905
224
+ ],
225
+ [
226
+ -0.9914319947897983,
227
+ -0.04793219636119889,
228
+ -0.1215117453545661,
229
+ 4665.762385022123
230
+ ],
231
+ [
232
+ 0.0,
233
+ 0.0,
234
+ 0.0,
235
+ 1.0
236
+ ]
237
+ ],
238
+ "T_w2c": [
239
+ [
240
+ -0.1273677302838765,
241
+ 0.02898380564134284,
242
+ -0.9914319947897983,
243
+ 4186.443157203164
244
+ ],
245
+ [
246
+ 0.5611442706308235,
247
+ 0.8263289974884052,
248
+ -0.04793219636119889,
249
+ 637.2127665859709
250
+ ],
251
+ [
252
+ 0.817859748869288,
253
+ -0.5624413986544308,
254
+ -0.1215117453545661,
255
+ 3988.4678286535363
256
+ ],
257
+ [
258
+ 0.0,
259
+ 0.0,
260
+ 0.0,
261
+ 1.0
262
+ ]
263
+ ],
264
+ "rvec_w2c": [
265
+ -0.4694560197186951,
266
+ -1.6508604641127633,
267
+ 0.48556164327500106
268
+ ],
269
+ "tvec_w2c_mm": [
270
+ 4186.443157203164,
271
+ 637.2127665859709,
272
+ 3988.4678286535363
273
+ ],
274
+ "position_mm": [
275
+ -3086.3578269629165,
276
+ 1595.3929826393905,
277
+ 4665.762385022123
278
+ ],
279
+ "reproj": {
280
+ "train_mean_px": 2.9123992347237126,
281
+ "train_median_px": 2.2898165257514562,
282
+ "test_mean_px": 4.850453175326985,
283
+ "test_median_px": 2.715830090531422,
284
+ "n_train_frames": 627,
285
+ "n_trimmed": 0,
286
+ "n_test_frames": 157,
287
+ "n_train_corners": 18876
288
+ }
289
+ },
290
+ "2": {
291
+ "K": [
292
+ [
293
+ 737.587,
294
+ 0.0,
295
+ 959.519
296
+ ],
297
+ [
298
+ 0.0,
299
+ 737.055,
300
+ 522.671
301
+ ],
302
+ [
303
+ 0.0,
304
+ 0.0,
305
+ 1.0
306
+ ]
307
+ ],
308
+ "dist": [
309
+ 0.0308,
310
+ 0.0122,
311
+ 0.0004,
312
+ -0.0001,
313
+ -0.0083,
314
+ 0.0405,
315
+ 0.0504,
316
+ -0.0177
317
+ ],
318
+ "width": 1920,
319
+ "height": 1080,
320
+ "T_c2w": [
321
+ [
322
+ 0.7645834671851738,
323
+ -0.23262169861846244,
324
+ -0.6010817473846294,
325
+ 1695.871702374565
326
+ ],
327
+ [
328
+ -0.07546393812269152,
329
+ 0.893872536651561,
330
+ -0.44192429471926337,
331
+ 2080.0126065963896
332
+ ],
333
+ [
334
+ 0.6400916463680125,
335
+ 0.38324800528112996,
336
+ 0.6658856138241177,
337
+ -3191.0268291764323
338
+ ],
339
+ [
340
+ 0.0,
341
+ 0.0,
342
+ 0.0,
343
+ 1.0
344
+ ]
345
+ ],
346
+ "T_w2c": [
347
+ [
348
+ 0.7645834671851738,
349
+ -0.07546393812269152,
350
+ 0.6400916463680125,
351
+ 902.8800932278815
352
+ ],
353
+ [
354
+ -0.23262169861846244,
355
+ 0.893872536651561,
356
+ 0.38324800528112996,
357
+ -241.8149217997485
358
+ ],
359
+ [
360
+ -0.6010817473846294,
361
+ -0.44192429471926337,
362
+ 0.6658856138241177,
363
+ 4063.4244892561123
364
+ ],
365
+ [
366
+ 0.0,
367
+ 0.0,
368
+ 0.0,
369
+ 1.0
370
+ ]
371
+ ],
372
+ "rvec_w2c": [
373
+ -0.46639607911242775,
374
+ 0.7015242808618536,
375
+ -0.088827222262893
376
+ ],
377
+ "tvec_w2c_mm": [
378
+ 902.8800932278815,
379
+ -241.8149217997485,
380
+ 4063.4244892561123
381
+ ],
382
+ "position_mm": [
383
+ 1695.871702374565,
384
+ 2080.0126065963896,
385
+ -3191.0268291764323
386
+ ],
387
+ "reproj": {
388
+ "train_mean_px": 2.0529125582436367,
389
+ "train_median_px": 1.7389845200626883,
390
+ "test_mean_px": 2.336579099817837,
391
+ "test_median_px": 1.8515414087232207,
392
+ "n_train_frames": 687,
393
+ "n_trimmed": 24,
394
+ "n_test_frames": 170,
395
+ "n_train_corners": 34480
396
+ }
397
+ },
398
+ "3": {
399
+ "K": [
400
+ [
401
+ 737.212,
402
+ 0.0,
403
+ 944.628
404
+ ],
405
+ [
406
+ 0.0,
407
+ 736.787,
408
+ 527.42
409
+ ],
410
+ [
411
+ 0.0,
412
+ 0.0,
413
+ 1.0
414
+ ]
415
+ ],
416
+ "dist": [
417
+ 0.1187,
418
+ 0.0765,
419
+ 0.0006,
420
+ -0.0003,
421
+ -0.0486,
422
+ 0.119,
423
+ 0.1331,
424
+ -0.0638
425
+ ],
426
+ "width": 1920,
427
+ "height": 1080,
428
+ "T_c2w": [
429
+ [
430
+ -0.24288073954002531,
431
+ -0.7002303881280003,
432
+ -0.6713317733450432,
433
+ 621.9878572989348
434
+ ],
435
+ [
436
+ -0.1923931548658246,
437
+ 0.7130788333718614,
438
+ -0.6741687113459065,
439
+ 1734.8587761666608
440
+ ],
441
+ [
442
+ 0.9507858961518441,
443
+ -0.0345829573509181,
444
+ -0.30791264790456296,
445
+ 4748.038734726321
446
+ ],
447
+ [
448
+ 0.0,
449
+ 0.0,
450
+ 0.0,
451
+ 1.0
452
+ ]
453
+ ],
454
+ "T_w2c": [
455
+ [
456
+ -0.24288073954002531,
457
+ -0.1923931548658246,
458
+ 0.9507858961518441,
459
+ -4029.524439401385
460
+ ],
461
+ [
462
+ -0.7002303881280003,
463
+ 0.7130788333718614,
464
+ -0.0345829573509181,
465
+ -637.3550523829739
466
+ ],
467
+ [
468
+ -0.6713317733450432,
469
+ -0.6741687113459065,
470
+ -0.30791264790456296,
471
+ 3049.128895898004
472
+ ],
473
+ [
474
+ 0.0,
475
+ 0.0,
476
+ 0.0,
477
+ 1.0
478
+ ]
479
+ ],
480
+ "rvec_w2c": [
481
+ -0.7053996802643994,
482
+ 1.789034978135712,
483
+ -0.5600941230037197
484
+ ],
485
+ "tvec_w2c_mm": [
486
+ -4029.524439401385,
487
+ -637.3550523829739,
488
+ 3049.128895898004
489
+ ],
490
+ "position_mm": [
491
+ 621.9878572989348,
492
+ 1734.8587761666608,
493
+ 4748.038734726321
494
+ ],
495
+ "reproj": {
496
+ "train_mean_px": 2.5048194609653915,
497
+ "train_median_px": 1.9828813362491196,
498
+ "test_mean_px": 5.296709982790022,
499
+ "test_median_px": 2.9605944943266476,
500
+ "n_train_frames": 1009,
501
+ "n_trimmed": 130,
502
+ "n_test_frames": 253,
503
+ "n_train_corners": 36684
504
+ }
505
+ },
506
+ "4": {
507
+ "K": [
508
+ [
509
+ 737.465,
510
+ 0.0,
511
+ 945.476
512
+ ],
513
+ [
514
+ 0.0,
515
+ 737.047,
516
+ 517.935
517
+ ],
518
+ [
519
+ 0.0,
520
+ 0.0,
521
+ 1.0
522
+ ]
523
+ ],
524
+ "dist": [
525
+ 0.1174,
526
+ 0.0709,
527
+ 0.0004,
528
+ -0.0003,
529
+ -0.0456,
530
+ 0.1168,
531
+ 0.1266,
532
+ -0.0605
533
+ ],
534
+ "width": 1920,
535
+ "height": 1080,
536
+ "T_c2w": [
537
+ [
538
+ -0.1623058952295233,
539
+ -0.17889022485241673,
540
+ -0.9703891404101731,
541
+ 3713.19484829117
542
+ ],
543
+ [
544
+ 0.0006797727246361657,
545
+ 0.9834084206660851,
546
+ -0.1814040133847063,
547
+ 1718.4154601049672
548
+ ],
549
+ [
550
+ 0.9867402567458093,
551
+ -0.030102584860567147,
552
+ -0.1594913793969019,
553
+ 2041.3929037594426
554
+ ],
555
+ [
556
+ 0.0,
557
+ 0.0,
558
+ 0.0,
559
+ 1.0
560
+ ]
561
+ ],
562
+ "T_w2c": [
563
+ [
564
+ -0.1623058952295233,
565
+ 0.0006797727246361657,
566
+ 0.9867402567458093,
567
+ -1412.8192759204858
568
+ ],
569
+ [
570
+ -0.17889022485241673,
571
+ 0.9834084206660851,
572
+ -0.030102584860567147,
573
+ -964.1987692191888
574
+ ],
575
+ [
576
+ -0.9703891404101731,
577
+ -0.1814040133847063,
578
+ -0.1594913793969019,
579
+ 4240.55598824576
580
+ ],
581
+ [
582
+ 0.0,
583
+ 0.0,
584
+ 0.0,
585
+ 1.0
586
+ ]
587
+ ],
588
+ "rvec_w2c": [
589
+ -0.133619850909165,
590
+ 1.7284128828711223,
591
+ -0.15858486293258514
592
+ ],
593
+ "tvec_w2c_mm": [
594
+ -1412.8192759204858,
595
+ -964.1987692191888,
596
+ 4240.55598824576
597
+ ],
598
+ "position_mm": [
599
+ 3713.19484829117,
600
+ 1718.4154601049672,
601
+ 2041.3929037594426
602
+ ],
603
+ "reproj": {
604
+ "train_mean_px": 1.4613748493136391,
605
+ "train_median_px": 1.1594095402838214,
606
+ "test_mean_px": 1.6130319002559326,
607
+ "test_median_px": 1.1533180102645888,
608
+ "n_train_frames": 188,
609
+ "n_trimmed": 16,
610
+ "n_test_frames": 46,
611
+ "n_train_corners": 5512
612
+ }
613
+ },
614
+ "5": {
615
+ "K": [
616
+ [
617
+ 737.302,
618
+ 0.0,
619
+ 952.888
620
+ ],
621
+ [
622
+ 0.0,
623
+ 736.73,
624
+ 526.617
625
+ ],
626
+ [
627
+ 0.0,
628
+ 0.0,
629
+ 1.0
630
+ ]
631
+ ],
632
+ "dist": [
633
+ 0.0332,
634
+ 0.0126,
635
+ 0.0007,
636
+ -0.0004,
637
+ -0.0085,
638
+ 0.0437,
639
+ 0.0496,
640
+ -0.0174
641
+ ],
642
+ "width": 1920,
643
+ "height": 1080,
644
+ "T_c2w": [
645
+ [
646
+ -0.9973782763362055,
647
+ 0.07213843493199729,
648
+ -0.005711400719771116,
649
+ -1000.5730935999982
650
+ ],
651
+ [
652
+ 0.061071558275041855,
653
+ 0.7967711654402801,
654
+ -0.6011871378304732,
655
+ 2267.0088850087623
656
+ ],
657
+ [
658
+ -0.03881801981654879,
659
+ -0.5999597954267437,
660
+ -0.7990878582540357,
661
+ 4730.89176951348
662
+ ],
663
+ [
664
+ 0.0,
665
+ 0.0,
666
+ 0.0,
667
+ 1.0
668
+ ]
669
+ ],
670
+ "T_w2c": [
671
+ [
672
+ -0.9973782763362055,
673
+ 0.061071558275041855,
674
+ -0.03881801981654879,
675
+ -952.7557822150793
676
+ ],
677
+ [
678
+ 0.07213843493199729,
679
+ 0.7967711654402801,
680
+ -0.5999597954267437,
681
+ 1104.2373238588418
682
+ ],
683
+ [
684
+ -0.005711400719771116,
685
+ -0.6011871378304732,
686
+ -0.7990878582540357,
687
+ 5137.580080859871
688
+ ],
689
+ [
690
+ 0.0,
691
+ 0.0,
692
+ 0.0,
693
+ 1.0
694
+ ]
695
+ ],
696
+ "rvec_w2c": [
697
+ -0.10977643993672742,
698
+ -2.9611351907523313,
699
+ 0.9898479160566382
700
+ ],
701
+ "tvec_w2c_mm": [
702
+ -952.7557822150793,
703
+ 1104.2373238588418,
704
+ 5137.580080859871
705
+ ],
706
+ "position_mm": [
707
+ -1000.5730935999982,
708
+ 2267.0088850087623,
709
+ 4730.89176951348
710
+ ],
711
+ "reproj": {
712
+ "train_mean_px": 2.24573616833002,
713
+ "train_median_px": 1.8089978412962404,
714
+ "test_mean_px": 4.230362441587578,
715
+ "test_median_px": 2.9070329441325065,
716
+ "n_train_frames": 1428,
717
+ "n_trimmed": 180,
718
+ "n_test_frames": 359,
719
+ "n_train_corners": 70192
720
+ }
721
+ },
722
+ "6": {
723
+ "K": [
724
+ [
725
+ 739.387,
726
+ 0.0,
727
+ 961.24
728
+ ],
729
+ [
730
+ 0.0,
731
+ 738.941,
732
+ 549.495
733
+ ],
734
+ [
735
+ 0.0,
736
+ 0.0,
737
+ 1.0
738
+ ]
739
+ ],
740
+ "dist": [
741
+ 0.0276,
742
+ 0.0066,
743
+ 0.0002,
744
+ -0.0001,
745
+ -0.0067,
746
+ 0.0367,
747
+ 0.0447,
748
+ -0.0162
749
+ ],
750
+ "width": 1920,
751
+ "height": 1080,
752
+ "T_c2w": [
753
+ [
754
+ 0.9916450051259756,
755
+ -0.02103931769764785,
756
+ -0.12726952077980477,
757
+ -822.905107559007
758
+ ],
759
+ [
760
+ -0.059829073356569874,
761
+ 0.7990615505095611,
762
+ -0.5982650921444025,
763
+ 2137.051918522988
764
+ ],
765
+ [
766
+ 0.11428326994795826,
767
+ 0.6008810078610188,
768
+ 0.791126632469119,
769
+ 600.3222048177358
770
+ ],
771
+ [
772
+ 0.0,
773
+ 0.0,
774
+ 0.0,
775
+ 1.0
776
+ ]
777
+ ],
778
+ "T_w2c": [
779
+ [
780
+ 0.9916450051259756,
781
+ -0.059829073356569874,
782
+ 0.11428326994795826,
783
+ 875.2807910147145
784
+ ],
785
+ [
786
+ -0.02103931769764785,
787
+ 0.7990615505095611,
788
+ 0.6008810078610188,
789
+ -2085.671592999592
790
+ ],
791
+ [
792
+ -0.12726952077980477,
793
+ -0.5982650921444025,
794
+ 0.791126632469119,
795
+ 698.8619399723472
796
+ ],
797
+ [
798
+ 0.0,
799
+ 0.0,
800
+ 0.0,
801
+ 1.0
802
+ ]
803
+ ],
804
+ "rvec_w2c": [
805
+ -0.6452000755181322,
806
+ 0.12996738163803703,
807
+ 0.020870812389210323
808
+ ],
809
+ "tvec_w2c_mm": [
810
+ 875.2807910147145,
811
+ -2085.671592999592,
812
+ 698.8619399723472
813
+ ],
814
+ "position_mm": [
815
+ -822.905107559007,
816
+ 2137.051918522988,
817
+ 600.3222048177358
818
+ ],
819
+ "reproj": {
820
+ "train_mean_px": 2.500777328745501,
821
+ "train_median_px": 2.07068963345984,
822
+ "test_mean_px": 4.627448446658975,
823
+ "test_median_px": 3.2401133841767678,
824
+ "n_train_frames": 1100,
825
+ "n_trimmed": 70,
826
+ "n_test_frames": 275,
827
+ "n_train_corners": 45168
828
+ }
829
+ },
830
+ "7": {
831
+ "K": [
832
+ [
833
+ 733.987,
834
+ 0.0,
835
+ 934.021
836
+ ],
837
+ [
838
+ 0.0,
839
+ 733.457,
840
+ 520.834
841
+ ],
842
+ [
843
+ 0.0,
844
+ 0.0,
845
+ 1.0
846
+ ]
847
+ ],
848
+ "dist": [
849
+ 0.1232,
850
+ 0.0888,
851
+ 0.0004,
852
+ -0.0,
853
+ -0.0489,
854
+ 0.1256,
855
+ 0.1456,
856
+ -0.0637
857
+ ],
858
+ "width": 1920,
859
+ "height": 1080,
860
+ "T_c2w": [
861
+ [
862
+ -0.04408698598699251,
863
+ -0.35887400401534364,
864
+ -0.9323442427068329,
865
+ -951.4227472070256
866
+ ],
867
+ [
868
+ -0.007197501376451948,
869
+ 0.9333415246765598,
870
+ -0.3589175313193418,
871
+ 2244.2097397499574
872
+ ],
873
+ [
874
+ 0.9990017685872827,
875
+ -0.009113043203552273,
876
+ -0.04373121085736698,
877
+ -957.9700582817479
878
+ ],
879
+ [
880
+ 0.0,
881
+ 0.0,
882
+ 0.0,
883
+ 1.0
884
+ ]
885
+ ],
886
+ "T_w2c": [
887
+ [
888
+ -0.04408698598699251,
889
+ -0.007197501376451948,
890
+ 0.9990017685872827,
891
+ 931.2211238442036
892
+ ],
893
+ [
894
+ -0.35887400401534364,
895
+ 0.9333415246765598,
896
+ -0.009113043203552273,
897
+ -2444.785053522505
898
+ ],
899
+ [
900
+ -0.9323442427068329,
901
+ -0.3589175313193418,
902
+ -0.04373121085736698,
903
+ -123.46049179867488
904
+ ],
905
+ [
906
+ 0.0,
907
+ 0.0,
908
+ 0.0,
909
+ 1.0
910
+ ]
911
+ ],
912
+ "rvec_w2c": [
913
+ -0.28912213588998953,
914
+ 1.5963056590146754,
915
+ -0.2906694025938897
916
+ ],
917
+ "tvec_w2c_mm": [
918
+ 931.2211238442036,
919
+ -2444.785053522505,
920
+ -123.46049179867488
921
+ ],
922
+ "position_mm": [
923
+ -951.4227472070256,
924
+ 2244.2097397499574,
925
+ -957.9700582817479
926
+ ],
927
+ "reproj": {
928
+ "train_mean_px": 3.475393358339814,
929
+ "train_median_px": 2.9746573817404833,
930
+ "test_mean_px": 5.838131593355678,
931
+ "test_median_px": 4.266213525838221,
932
+ "n_train_frames": 440,
933
+ "n_trimmed": 7,
934
+ "n_test_frames": 111,
935
+ "n_train_corners": 24092
936
+ }
937
+ }
938
+ }
939
+ }