This repository is a work in progress 🚧
Bike fit analysis with a single RGB camera, without expensive infrared cameras or sensor rigs.
Things you need:
- A bike
- An indoor trainer
- An RGB camera that can capture video (at least 30fps)
Record a video of yourself riding a bike on an indoor trainer. The drive-side of the bike should face the camera, meaning the rider looks into the right side of the image.
Tips to get the best results:
- Make sure the camera is parallel to the bike. Don't place the camera too low on the ground or too high. This will increase the projective distortion which leads to inaccurate analysis. In the best case, the camera is aligned with the bottom bracket of the bike and at knee height.
- Use a tripod
- Make sure the capture is in a well-lit area and on a flat background (a wall is perfect). Make sure there is no other person in the video or the analysis will be skewed.
- 30 seconds is usually enough to get meaningful results.
- python3
python3-tksystem package for the GUI backend. Install withsudo apt install python3-tkpipto install application packages. Install withsudo apt install python3-pip
It is recommended to create a virtual environment and install the dependencies there to avoid any conflicts with system packages.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtOnce you recorded your video, you are ready to feed it into the analysis pipeline.
python entrypoint.py --video /path/to/video.mp4 --backend mediapipe # or --backend rtmlib-
--videopath to the video file to analyze. -
--backenddefaults tomediapipeif omitted.- The
mediapipebackend must be run from the repo root — it loads the MediaPipe model via the relative path./pose_landmarker.task. - The
rtmlibbackend has no such constraint: it auto-downloads and caches its ONNX weights (to~/.cache/rtmlib) on first use, which requires internet access the first time it runs.
- The
Press q in the video preview window to stop processing early; otherwise the loop runs until the
video ends. Either way, the joint-angle plot window stays open afterward for inspection until you
close it.