opencap-monocular: OpenCap Monocular: The Biomechanics Engine That Learns the Floor

Inside the smartphone-video pipeline that decides whether the camera moved, whether the person is on a treadmill, and how to stop feet from skating before exporting OpenSim-ready motion files.

9 min read • View on GitHub • More from utahmobl

A wide editorial scene shows a smartphone on a tripod on one side and a handheld phone on the other, both aimed at the same runner. The runner's foot path is drawn twice, once as a loose sliding arc and once as a line pinned to a floor plane by taut mechanical tension. The image explains that the system does not treat every video the same way, because the camera setup changes the math.
Same video, different assumptions. OpenCap Monocular changes its optimization rules when the camera moves or the activity changes.
Key Takeaways

The phone is not the model. The floor is.

Most consumer video pipelines ask a single question: what pose is the person in? OpenCap Monocular asks a different one: what physical assumptions can this scene actually support? That distinction is the whole article, because the repo treats motion capture as a biomechanics problem first and a vision problem second.

That is why the same video can trigger different math. A static tripod, a moving handheld camera, sidewalk walking, and treadmill walking are not cosmetic variants here. They change the loss terms, the camera model, and how aggressively the system tries to pin feet to the floor.

The output is not a polished demo clip. It is motion data that can survive a round-trip into OpenSim, where joint angles and body mechanics matter more than a pretty skeleton overlay.

Why a treadmill breaks generic motion math

The repository's `params/parameters.yaml` makes the point plainly. Walking and treadmill walking are not treated as the same scene, because the floor is not behaving the same way. If you keep the wrong contact assumptions, the feet skate, the body drifts, and the output becomes hard to trust.

A close-up editorial scene shows a single foot hovering just above a grid floor while a thin vector snaps it downward into contact. One path looks like a sliding smear, while the corrected path locks onto the ground plane with mechanical precision. The image explains why contact constraints and floor assumptions matter more than raw pose estimates.
When foot contact is wrong, the skeleton can look plausible and still be mechanically useless.

A simplified view of the activity presets looks like this:

activities:
  walking:
    flat_floor: 1.0
    contact_velocity: 1.0
  treadmill:
    flat_floor: 1.0
    contact_velocity: 0.0
static_cam: auto

That tiny switch matters. A treadmill changes the relationship between the body, the belt, and the background, so the optimizer cannot rely on the same contact penalties it would use on a fixed floor. In practice, the repo is deciding when to trust foot contact, when to relax it, and when to let the scene's physics rule the result.

How the pipeline turns pixels into biomechanics

The flow is not mysterious once you separate the jobs. WHAM provides an initial 3D pose and shape estimate. SLAHMR helps with camera and scene optimization. Then the repository refines the result with biomechanical constraints and exports OpenSim-friendly files such as `.trc` and `.mot`.

A left-to-right map of how the repository turns ordinary video into OpenSim-ready motion, while activity presets change the optimization policy.

That architecture matters because the repo does not collapse everything into one giant model. It stages the problem. First it estimates, then it optimizes, then it exports. Each step adds a different kind of truth, which is why the result feels closer to a workflow than a single inference call.

The engineering trick that makes it production-shaped

The repo's service layer shows the same discipline. In `mono_api.py`, path re-rooting keeps files usable across Docker boundaries and worker nodes, which is the kind of boring problem that quietly breaks ML systems in the real world. The code also hashes requests so expensive GPU work can be cached instead of repeated.

A simplified sketch of the hashing logic looks like this:

def generate_request_hash(video_path, height, mass, sex):
    payload = f'{video_path}:{height}:{mass}:{sex}'
    return hashlib.md5(payload.encode()).hexdigest()

That is not glamorous, but it is the difference between a research prototype and a system you can run repeatedly. The expensive part of biomechanics is not just the model, it is the compute budget and the file management around the model. OpenCap Monocular is built like it knows that.

What OpenCap Monocular is really competing with

The cleanest comparison is not model versus model. It is workflow versus workflow. On one side are lab-grade motion capture systems that are accurate but expensive and controlled. On the other are generic pose estimators that are cheap and flexible but often too sloppy for biomechanics.

DimensionOpenCap MonocularMulti-camera MoCap labGeneric pose estimation
HardwareConsumer smartphone videoDedicated camera arrays and lab setupAny ordinary video source
Scene assumptionsAdapts to camera motion and activityControlled capture volumeUsually assumes a general visual scene
Main strengthPhysics-aware refinement before exportHigh-fidelity capture in a labFast, accessible pose estimates
Common failure modeDepends on good activity presets and constraintsCost and logistics limit scaleFoot slide and weak biomechanical consistency
Best use caseOpenSim-ready motion from cheap videoGold-standard measurement in specialized settingsRough pose from everyday video

That table is the point. OpenCap Monocular is not trying to be the cheapest vision model or the most accurate lab rig. It occupies the middle ground that matters in practice: enough physics to keep the motion honest, enough automation to make the pipeline accessible.

Why this repo matters now

The broader shift is easy to miss. Motion data used to live in labs because the hardware, calibration, and analysis were specialized. This repo pushes that boundary outward by using commodity sensors, learned pose priors, and a second layer of biomechanics-aware optimization.

That is the real product idea. Not just video in, skeleton out. It is video in, assumptions checked, physics repaired, and OpenSim-ready motion out. In a field where small errors can snowball into bad conclusions, that extra layer of discipline is the difference between convenient and clinically useful.