Portable Biomechanics Laboratory: Clinically Accessible Movement Analysis from a Handheld Smartphone
J.D. Peiffer1,2, Kunal Shah1, Irina Djuraskovic1,3, Shawana Anarwala1, Kayan Abdou1, Rujvee Patel4, Prakash Jayabalan1,5, Brenton Pennicooke4, R. James Cotton1,5
1Shirley Ryan AbilityLab, Chicago, IL
2Biomedical Engineering, Northwestern University, Evanston, IL
3Interdepartmental Neuroscience, Northwestern University, Chicago, IL
4Neurological Surgery, Washington University School of Medicine, St. Louis, MO, USA
5Physical Medicine and Rehabilitation, Northwestern University Feinberg School of Medicine, Chicago, IL, USA
This repository includes code and a gradio demo for running the single camera (monocular) biomechanical fitting code from smartphone videos.
Movement directly reflects neurological and musculoskeletal health, yet objective biomechanical assessment is rarely available in routine care. We introduce Portable Biomechanics Laboratory (PBL), a platform for fitting biomechanical models to handheld smartphone video. We validate PBL on over 15 hours of data synchronized to ground truth motion capture, finding joint-angle errors < 3 degrees across patients with neurological injury, lower-limb prosthesis users, pediatric inpatients, and controls. Across 1021 videos recorded in prospective clinical deployment, PBL was easy to implement, yielded reliable gait metrics (ICC > 0.9), and detected clinically relevant differences in movement. For cervical myelopathy patients, its gait quality measures correlated with modified Japanese Orthopedic Association (mJOA) scores and were responsive to clinical intervention. Handheld smartphone video can therefore deliver accurate, scalable, and low-burden biomechanical measurement, enabling greatly increased monitoring of movement impairments. We release the first clinically validated method for measuring whole-body kinematics from handheld smartphone video at https://github.com/IntelligentSensingAndRehabilitation/MonocularBiomechanics.
Tested with Ubuntu 24.04.3 LTS using uv.
Clone and install
git clone git@github.com:IntelligentSensingAndRehabilitation/MonocularBiomechanics.git
cd MonocularBiomechanics/
uv sync --extra cuda # GPU (CUDA 12)
# uv sync # CPU only
EGL/OpenGL system dependencies: The rendering pipeline uses EGL (via PyOpenGL and MuJoCo). On Ubuntu/Debian, install the required system packages before running:
sudo apt-get install libgl1 libegl1 libgles2 libosmesa6-dev libglib2.0-0 ffmpeg
MUJOCO_GL and PYOPENGL_PLATFORM default to egl. Update these environment variables if you need to use a different rendering backend.
Note: Setting "setuptools==81.0.0" in pyproject.toml may help resolve some tensorflow version errors.
Note 2: Windows is not supported. WSL may work for biomechanical fitting but is not supported for overlay creation.
uv run python main.py
A local webpage will open to upload and run the code.
Note that this demo is not optimized for videos with many people in view -- if you want to do so, consider using PosePipeline to annotate the person of interest.
This demo is intended for proof-of-concept fitting only. Production runs should consider using PosePipeline or contact the authors for a Docker container.
Camera intrinsics: The demo uses default camera intrinsics from a Samsung Galaxy S20 (see monocular_demos/dataset.py:get_samsung_calibration). Most proof-of-concept fits will work fine with these defaults, but results may vary if your camera's intrinsics differ significantly. For best results, provide calibration parameters specific to your device.
A jupyter notebook with steps to run the pipeline can be found here.
To reproduce the error tables from the paper, first download the data from Zenodo and place the CSV files in data/clinical/, then run:
python analysis/compute_clinical_errors.py
This work has been presented at the 2024 American Society of Biomechanics Meeting and 2025 European Society of Biomechanics Meeting.
@misc{peiffer_portable_2025,
title = {Portable Biomechanics Laboratory: Clinically Accessible Movement Analysis from a Handheld Smartphone},
doi = {10.48550/arXiv.2507.08268},
number = {{arXiv}:2507.08268},
publisher = {{arXiv}},
author = {Peiffer, J. D. and Shah, Kunal and Djuraskovic, Irina and Anarwala, Shawana and Abdou, Kayan and Patel, Rujvee and Jayabalan, Prakash and Pennicooke, Brenton and Cotton, R. James},
date = {2025-07-11},
}