File size: 4,994 Bytes
6f9bc03 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | # Joint-mocap frame → nerfstudio frame transforms
All point clouds in this folder live in the **joint mocap frame**, defined
as:
- **Origin** at the center of the ArUco tag on the floor.
- **+z** points up (tag normal).
- **+x** is along the tag's printed **+y** direction (a +90° yaw about z
relative to the tag's intrinsic axes, applied during dataset construction).
- **+y** completes the right-handed frame (`= z × x`).
The **left scene's mocap frame** is the reference. The right scene's
points were aligned to this frame via ICP — that correction is included in
the `*_aligned_mocap` PLYs and in the `joint_mocap_to_nerf_4x4` for the
right scene below.
## Files in this folder
| file | what it contains |
|---|---|
| `left_gate.ply`, `right_gate.ply` | gate point clouds in joint mocap |
| `left_table.ply`, `right_table.ply` | table point clouds in joint mocap |
| `objects_summary.json` | AABBs, polygon / plane cut definitions per object |
| `joint_mocap_to_nerf.json` | the transforms documented here |
| `right_to_left_icp.json` | raw ICP output for the right→joint correction |
## The transform chain
For a single point `p_joint = [x, y, z]` in the **joint mocap frame**, the
chain that maps it into each scene's **nerfstudio internal frame** is:
```
joint_mocap
│ T_icp_inv (identity for the left scene)
▼
scene_mocap
│ M_dataparser = [[s·R, s·t], [0, 1]]
▼ (p_nerf = s · (R · p_mocap + t))
nerfstudio internal
```
For the **left** scene, `joint_mocap == left_mocap`, so the ICP step is the
identity and the only transform is the dataparser.
For the **right** scene, the ICP correction is applied first (joint →
right's original mocap), then the right scene's dataparser carries it the
rest of the way into right's nerf frame.
`joint_mocap_to_nerf.json` exposes both the composed 4×4 (everything in
one matrix per scene, ready to apply with a single matmul) and the
building blocks if you want to inspect or recompose.
## Quick usage (Python)
```python
import json, numpy as np
import open3d as o3d
ROOT = "/home/javier/Downloads/polycam_gsplat/object_pcds/objects_final"
xforms = json.load(open(f"{ROOT}/joint_mocap_to_nerf.json"))
def to_homogeneous(p_xyz):
return np.array([*p_xyz, 1.0])
# --- joint mocap -> nerf for either scene ---------------------------------
def joint_to_nerf(p_joint, scene):
"""scene in {"left_gate_new", "right_gate_new"}; p_joint is (3,)."""
M = np.asarray(xforms["scenes"][scene]["joint_mocap_to_nerf_4x4"])
return (M @ to_homogeneous(p_joint))[:3]
# --- nerf -> joint mocap --------------------------------------------------
def nerf_to_joint(p_nerf, scene):
M = np.asarray(xforms["scenes"][scene]["nerf_to_joint_mocap_4x4"])
return (M @ to_homogeneous(p_nerf))[:3]
# Example: tag origin
print(joint_to_nerf([0, 0, 0], "left_gate_new")) # ≈ (-0.157, -0.080, -0.188)
print(joint_to_nerf([0, 0, 0], "right_gate_new")) # ≈ (-0.112, 0.031, -0.201)
```
## Mapping a whole point cloud
```python
pcd = o3d.io.read_point_cloud(f"{ROOT}/left_table.ply") # already in joint mocap
M = np.asarray(xforms["scenes"]["left_gate_new"]["joint_mocap_to_nerf_4x4"])
pcd_in_nerf = o3d.geometry.PointCloud(pcd).transform(M)
```
For the **right** scene's PLYs in this folder (which are already
ICP-aligned to joint mocap), use the right scene's
`joint_mocap_to_nerf_4x4`. Internally that matrix is the composition
`M_right_dataparser @ T_icp_inv`, so it correctly accounts for the ICP
correction.
## Bypassing joint mocap and going directly between the two nerf frames
```python
# point in the right scene's nerf frame -> left scene's nerf frame
M_right_to_joint = np.asarray(xforms["scenes"]["right_gate_new"]["nerf_to_joint_mocap_4x4"])
M_joint_to_left = np.asarray(xforms["scenes"]["left_gate_new"]["joint_mocap_to_nerf_4x4"])
p_left_nerf = (M_joint_to_left @ M_right_to_joint @ to_homogeneous(p_right_nerf))[:3]
```
## Where each field comes from
- `right_to_joint_icp.transformation_4x4` is the SE(3) returned by
`align_right_to_left_icp.py` (multi-scale point-to-plane ICP, voxel
schedule 0.10 → 0.05 → 0.02 m, final inlier RMSE ≈ 0.028 m).
- `scenes.<scene>.dataparser` is read from each splat's
`dataparser_transforms.json` produced at training time
(`mocap_outputs/.../sagesplat/<timestamp>/dataparser_transforms.json`).
The formula is `p_nerf = scale * (R · p_mocap + t)`; we fold scale
into the 4×4 via `M = [[s·R, s·t], [0, 1]]`.
- `scenes.<scene>.joint_mocap_to_nerf_4x4` is what you almost always
want. For the left scene it equals `M_dataparser`; for the right
scene it equals `M_dataparser @ T_icp_inv`.
## Sanity check
A round-trip of any `p_joint` through `joint_mocap_to_nerf_4x4` and back
through `nerf_to_joint_mocap_4x4` should return the original within
floating-point noise. The build script asserts this for the tag origin
before writing the JSON.
|