Spaces:
Paused
Paused
| """The ONE entrypoint a tool author edits. | |
| `process(video_path, engine, fps)` reconstructs 3D pose from the multi-camera | |
| montage video and returns a 3D-skeleton + joint-angle summary image and a report. | |
| `simulate_full` also returns the raw result so the UI can build the 3D video. | |
| """ | |
| from __future__ import annotations | |
| import numpy as np | |
| from . import fast_pose3d, viz | |
| from .io import read_video | |
| ENGINES = ["fast", "deepfly3d"] | |
| def simulate_full(video_path: str, engine: str = "fast", fps: float = 20.0) -> dict: | |
| if engine not in ENGINES: | |
| raise ValueError(f"Unknown engine '{engine}'. Choose one of {ENGINES}.") | |
| movie = read_video(video_path) | |
| if engine == "deepfly3d": | |
| from . import deepfly3d | |
| res = deepfly3d.analyze(movie, fps=float(fps)) | |
| else: | |
| res = fast_pose3d.analyze(movie, fps=float(fps)) | |
| return { | |
| "summary": viz.summary_image(movie, res), | |
| "report": res["report"], | |
| "res": res, | |
| "movie": movie, | |
| } | |
| def process(video_path: str, engine: str = "fast", fps: float = 20.0) -> tuple[np.ndarray, dict]: | |
| """Returns (3D skeleton + joint-angle summary RGB, report dict).""" | |
| r = simulate_full(video_path, engine, fps) | |
| return r["summary"], r["report"] | |