fix(tracking): construct RPT camera payloads via typed bindings
Switch the triangulation adapter from ad hoc Python dictionaries to rpt.make_camera so the tracker passes the exact typed camera objects expected by the current RPT bindings. The camera convention test now asserts against the bound camera object's numeric fields instead of raw dict payloads, which keeps the test aligned with the compiled interface.
This commit is contained in:
@@ -15,16 +15,16 @@ def build_rpt_config(
|
||||
min_group_size: int,
|
||||
) -> TriangulationConfig:
|
||||
cameras = [
|
||||
{
|
||||
"name": camera.name,
|
||||
"width": camera.width,
|
||||
"height": camera.height,
|
||||
"K": camera.K.tolist(),
|
||||
"DC": camera.DC.tolist(),
|
||||
"R": camera.pose_R.tolist(),
|
||||
"T": camera.pose_T.reshape(3, 1).tolist(),
|
||||
"model": camera.model,
|
||||
}
|
||||
rpt.make_camera(
|
||||
name=camera.name,
|
||||
width=camera.width,
|
||||
height=camera.height,
|
||||
K=camera.K,
|
||||
DC=camera.DC,
|
||||
R=camera.pose_R,
|
||||
T=camera.pose_T,
|
||||
model=camera.model,
|
||||
)
|
||||
for camera in scene.cameras
|
||||
]
|
||||
roomparams = np.asarray([scene.room_size, scene.room_center], dtype=np.float32)
|
||||
|
||||
@@ -7,6 +7,7 @@ import numpy as np
|
||||
import pytest
|
||||
|
||||
pytest.importorskip("rpt")
|
||||
import rpt
|
||||
|
||||
from pose_tracking_exp.schema import CameraCalibration, CameraModel, SceneConfig, parse_camera_model
|
||||
from pose_tracking_exp.tracking.replay_io import load_scene_file
|
||||
@@ -125,7 +126,7 @@ def test_build_rpt_config_uses_pose_convention(monkeypatch: pytest.MonkeyPatch)
|
||||
captured: dict[str, object] = {}
|
||||
|
||||
def fake_make_triangulation_config(
|
||||
cameras: list[dict[str, object]],
|
||||
cameras: list[rpt.Camera],
|
||||
roomparams: np.ndarray,
|
||||
joint_names: list[str],
|
||||
*,
|
||||
@@ -143,6 +144,6 @@ def test_build_rpt_config_uses_pose_convention(monkeypatch: pytest.MonkeyPatch)
|
||||
|
||||
build_rpt_config(scene, min_match_score=0.5, min_group_size=2)
|
||||
|
||||
camera_payload = cast(list[dict[str, object]], captured["cameras"])[0]
|
||||
assert camera_payload["R"] == camera.pose_R.tolist()
|
||||
assert camera_payload["T"] == camera.pose_T.reshape(3, 1).tolist()
|
||||
camera_payload = cast(list[rpt.Camera], captured["cameras"])[0]
|
||||
np.testing.assert_allclose(camera_payload.R, camera.pose_R.tolist())
|
||||
np.testing.assert_allclose(camera_payload.T, camera.pose_T.reshape(3, 1).tolist())
|
||||
|
||||
Reference in New Issue
Block a user