Files
raea/tools/matchmove/setup.py
shinyobjectz 4d44519fc1 Local models install and run on a Mac, Windows or Linux with nothing installed first
Each local model's setup is now tools/<model>/setup.py (standard library only, on tools/local_setup.py), run by uv
on any OS as raea runs it: uv on the PATH, else raea's own uv 0.12.24 fetched once into ~/.cache/raea-tools/uv (where
tools/ensure.sh puts it) and checked against its SHA-256. The setup.sh beside each is a wrapper for a Mac or Linux.
Until now each setup was a sh script needing uv already installed (brew install uv), so Windows had no way to
install any local model.

- SAO: Core ML on a Mac, ONNX Runtime elsewhere (CUDA where nvidia-smi finds a GPU; RAEA_SAO_CUDA=0|1); its WAV is
  written by Python's wave module, not an installed ffmpeg (same samples)
- matchmove, splat: footage read through PyAV, whose wheels carry FFmpeg's libraries (no ffmpeg/ffprobe needed);
  splat fetches Brush v0.3.0's release build for macOS arm64, Linux x86_64 or Windows x86_64, each SHA-256 checked
- goo: Taichi on Metal on a Mac, else its best GPU (CUDA, Vulkan) or the CPU; the backend is reported as run
- TokenSynth: its code as GitHub's archive at a pinned commit (no git); coremltools only on a Mac
- the engine runs .venv\Scripts\python.exe on Windows (venv_python), Brush's brush_app.exe
- tools/release.sh ships tools/local_setup.py
2026-11-18 16:24:45 -08:00

21 lines
1.2 KiB
Python

"""Matchmove (camera solve) for raea-render's asset store: `Store::matchmove(clip, {from, seconds, subject, height})`
solves the camera of a stretch of footage (COLMAP through pycolmap: BSD; OpenCV for the rotation-only fallback:
Apache-2.0) and keeps the solve as JSON, cached by the clip's content and the params. run.py is copied in beside the
venv; it reads the footage through PyAV (BSD; its wheels carry FFmpeg's own libraries), so no FFmpeg need be installed.
Installs into $RAEA_MATCHMOVE (default ~/.cache/raea-matchmove); raea-render runs this the first time a solve is asked
for and nothing is installed (a first `raea track`, a <Matchmove>), on any OS (tools/local_setup.py). Size: the venv
only (pycolmap, numpy, opencv-python-headless, pillow, av: about 300 MB). No model weights."""
import shutil
import sys
from pathlib import Path
HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE.parent))
from local_setup import FOOTAGE, Setup # noqa: E402
with Setup("matchmove", "RAEA_MATCHMOVE", "raea-matchmove") as s:
s.venv("3.11", FOOTAGE, imports=("pycolmap", "numpy", "cv2", "PIL", "av"))
shutil.copy2(HERE / "run.py", "run.py")
s.ready(".venv")