Real-time gait tracking and joint-angle estimation from video, built with MediaPipe Pose and OpenCV. The pipeline detects body landmarks, computes hip and knee angles live, smooths joint trajectories with a Kalman filter, and exports per-frame angle data to CSV for downstream gait analysis.
Computer-vision research project exploring markerless gait analysis as a low-cost alternative to lab-based motion capture.
- Real-time pose & angle estimation — hip and knee angles computed and overlaid live on the video feed.
- Ankle trajectory tracking — right-ankle path projected over time for stride visualisation.
- Kalman filtering — applied to ankle and knee positions for smooth, noise-reduced tracking.
- ArUco marker support — optional hip marker for improved hip-angle accuracy.
- Gait feature extraction — gait-cycle time, stride length and height derived from processed data.
- CSV export — per-frame hip/knee angles saved for further analysis (see
gait_angles.csvfor a sample).
| Area | Tools |
|---|---|
| Pose detection | MediaPipe Pose |
| Computer vision | OpenCV (incl. ArUco) |
| Signal smoothing | Kalman filter |
| Data & visualisation | NumPy, pandas, Matplotlib, SciPy |
| Language | Python |
# 1. Install dependencies (a virtual environment is recommended)
pip install -r requirements.txt
# 2. Open the notebooks
jupyter notebookangle_estimation.ipynb— joint-angle estimation from a live webcam feed. Each cell is annotated for clarity.gait_model.ipynb— full gait model on both video input and live webcam, including angle calculation and CSV export.
.
├── angle_estimation.ipynb # Live webcam joint-angle estimation
├── gait_model.ipynb # Full gait model (video + webcam) with CSV export
├── gait_angles.csv # Sample exported hip/knee angle data
├── marker_1.png # Sample generated ArUco marker
├── requirements.txt
├── ideal_data/ # Reference "ideal" hip/knee angles by subject height
│ ├── angles_164.csv # subject height 164 cm
│ └── angles_174.csv # subject height 174 cm
├── support_files/ # Component build/test notebooks and utilities
│ ├── aruco_creater.py # generates an ArUco marker
│ ├── gait_trajectory.ipynb
│ ├── graph_plotting.ipynb # plots recorded hip/knee angle data
│ └── ideal_analysis.ipynb # feature engineering on the ideal data
└── test_videos/ # Sample clips across resolutions/frame rates
| File | Resolution | Frame rate |
|---|---|---|
gait_video11.mp4 |
1080p | 30 fps |
gait_video12.mp4 |
1080p | 60 fps |
gait_video13.mp4 |
4K | 30 fps |
gait_video14.mp4 |
4K | 24 fps |
- The MediaPipe Pose (Heavy) model is loaded via the
mediapipepackage; no separate download is required. - File paths inside the notebooks may need adjusting to match your local layout.
Released under the MIT License.