MCPcopy Create free account
hub / github.com/Ropedia/SpatialBench / get_scene_cameras

Function get_scene_cameras

visualize_benchmark_web.py:1694–1711  ·  view source on GitHub ↗

Return camera positions and frustum data for all frames. Binary format: int32(N) | float32[N*12](poses 3x4) | float32[9](K 3x3)

(scene_id: str, z_far: float = Query(10.0), depth_mask: bool = Query(True), conf_threshold: float = Query(0.0))

Source from the content-addressed store, hash-verified

1692
1693@app.get("/api/scene/{scene_id}/cameras")
1694def get_scene_cameras(scene_id: str, z_far: float = Query(10.0), depth_mask: bool = Query(True), conf_threshold: float = Query(0.0)):
1695 """Return camera positions and frustum data for all frames.
1696
1697 Binary format: int32(N) | float32[N*12](poses 3x4) | float32[9](K 3x3)
1698 """
1699 scene = _find_scene(scene_id)
1700 if scene is None:
1701 return Response(status_code=404)
1702
1703 data = _load_scene_data_raw(scene, z_far, use_depth_mask=depth_mask, conf_threshold=conf_threshold)
1704 K = data["K"]
1705 poses = np.array(data["extrinsics"], dtype=np.float32)
1706
1707 buf = io.BytesIO()
1708 buf.write(struct.pack("<i", len(poses)))
1709 buf.write(poses.tobytes())
1710 buf.write(K.astype(np.float32).tobytes())
1711 return Response(content=buf.getvalue(), media_type="application/octet-stream")
1712
1713
1714def _find_scene(scene_id: str):

Callers

nothing calls this directly

Calls 3

_find_sceneFunction · 0.85
_load_scene_data_rawFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected