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))
| 1692 | |
| 1693 | @app.get("/api/scene/{scene_id}/cameras") |
| 1694 | def 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 | |
| 1714 | def _find_scene(scene_id: str): |
nothing calls this directly
no test coverage detected