03 Project

COMPUTER VISION · HUMAN POSE ESTIMATION · SPORTS ANALYTICS

RunRightAI

From Video to Sprint Velocity

Research Question

“Can computer vision estimate an athlete’s running velocity using an ordinary camera instead of specialized motion-capture equipment?”

RunRightAI explores this question through a video-processing pipeline combining athlete detection, tracking, human pose estimation, and geometric calibration to transform pixel coordinates into ground-plane velocity time series.

Computer Vision Research Project·2023–2024
YOLOv8MediaPipe PoseOpenCVSAHIComputer Vision
YOLOv8 + MediaPipeVision Stack
5 Markers (10m × 1.22m)Calibration
Velocity CurveOutput
RunRightAI project visual
Computer Vision2024
RoleComputer Vision Research Project · 2023–2024
01 — The Problem

Measuring physical movement from ordinary video

Analyzing sprint performance requires understanding how an athlete’s movement changes over time. While specialized motion-capture systems can provide detailed measurements, they require dedicated equipment and controlled environments.

Reference Systems

Dedicated Motion Capture

Traditional biomechanics analysis relies on retro-reflective optical markers, calibrated multi-camera arrays (e.g. Vicon, Qualisys), or instrumented force plates. These deliver millimeter-grade ground truth but remain restricted to laboratory conditions, cost thousands of dollars, and cannot be deployed on an open running track with a consumer smartphone or standard tripod camera.

Research Goal

Monocular Video Challenge

Ordinary video offers an accessible alternative, but translating 2D image-space motion into physical measurements introduces fundamental challenges: severe perspective foreshortening, non-linear pixel scale across the field of view, rapid limb occlusions, and bounding-box jitter that pollutes derivative velocity calculations.

02 — Context

A controlled video-analysis experiment

The project was developed around recorded sprint videos captured from a fixed camera. The experimental configuration uses five physical reference markers defining a measured ground-plane region of 10 m × 1.22 m, providing the spatial reference to transform image coordinates into real-world meters.

1. Camera Image PlanePixel Space (u, v)
Horizon lineM1 (u1,v1)M2 (u2,v2)M3 (u3,v3)M4M5 (u5,v5)Perspective distortion: non-linear distance compression
H
Planar Homography[X, Y, 1]³ ~ H · [u, v, 1]³
2. Calibrated Ground PlaneWorld Space (X, Y) [m]
M1: (0, 0)M2: (2.5, 0)M3: (5.0, 1.22)M4: (7.5, 0)M5: (10.0, 1.22)← 10.00 meters →1.22m
MarkerPixel Coordinates (u, v)Ground Coordinate (X, Y)Spatial Role
M1(184, 842)(0.00 m, 0.00 m)Lane origin / inner boundary
M2(462, 796)(2.50 m, 0.00 m)2.5m intermediate inner marker
M3(780, 712)(5.00 m, 1.22 m)5.0m outer lane boundary
M4(1128, 640)(7.50 m, 0.00 m)7.5m intermediate inner marker
M5(1512, 574)(10.00 m, 1.22 m)10.0m terminal outer boundary
03 — Approach

Combining detection, tracking, and geometric calibration

The pipeline integrates multiple computer vision stages to track the athlete and extract their running trajectory across video frames.

M1M2M3athlete 0.94 [ID: #1] LANDMARK #23: LEFT HIPu=420 px, v=230 pxH-projection footprint
STATUS: TRACKING_ACTIVE
SRC: 1080p @ 30 FPS
DETECTOR: YOLOv8-X (0.94 conf)
LANDMARKS: 33 POSE NODES
TRACKED: LEFT_HIP (#23)

ATHLETE TRACKING / POSE ESTIMATION: Bounding box association tracks the runner across frames, while MediaPipe Pose localizes joint landmarks. The left-hip keypoint (Landmark #23) serves as the primary center-of-mass proxy, which is projected onto the calibrated track plane to derive displacement.

Stage 01

Athlete Detection & Tracking

YOLOv8 detects people in individual video frames. A proximity-based spatial association algorithm links detections across consecutive frames, assigning a consistent track ID to isolate the sprint athlete from spectators or background movement.

Stage 02

Human Pose Estimation

MediaPipe Pose extracts 33 full-body anatomical landmarks from athlete-centered crops. The normalized landmark coordinates are transformed back into the original 1920×1080 video space to maintain exact geometric alignment with ground markers.

Stage 03

Ground-Plane Calibration

Physical reference cones/markers are detected via fine-tuned YOLOv8 paired with SAHI (Slicing Aided Hyper Inference) to locate small objects accurately. OpenCV computes the 3×3 homography matrix (H) from the five marker correspondences.

Stage 04

Velocity Estimation

The athlete’s left-hip horizontal trajectory, combined with the prototype’s fixed vertical reference, is projected through the homography matrix H. Consecutive transformed world positions produce frame-to-frame displacement (Δd) over time (Δt).

04 — Architecture

A modular video-processing pipeline

RunRightAI separates athlete detection, tracking, pose estimation, spatial calibration, and motion analysis into dedicated decoupled processing stages.

Branch A: Athlete MotionVideo Sequence
A1
YOLOv8 Person DetectionExtract candidate bounding boxes per frame
A2
Proximity-Based TrackerAssociate bounding boxes across time & lock athlete ID
A3
MediaPipe Pose Estimation33 anatomical landmarks extracted from cropped athlete
A4
Hip Trajectory ExtractionIsolate Left Hip landmark (u_t, v_t) in original video space
Branch B: Spatial CalibrationReference Geometry
B1
Reference Marker DetectionCustom YOLOv8 with SAHI for small-marker localization
B2
Marker Centroid ExtractionCompute sub-pixel centers for the 5 physical ground markers
B3
Track Dimension MappingAssociate image coords with 10.0m × 1.22m metric coordinates
B4
Planar Homography EstimationCompute 3×3 transformation matrix H via OpenCV RANSAC
Convergence: Trajectory × Homography Projection
1. Coordinate HomographyProject left hip trajectory into Euclidean ground-plane coordinates (X_t, Y_t) in meters.
2. Numerical DifferentiationCompute instantaneous velocity v(t) = Δd / Δt between consecutive frames.
3. Time-Series SmoothingApply windowed Savitzky-Golay filtering to isolate biomechanical stride oscillations.
05 — Results

Generating velocity estimates from video

The research prototype demonstrates an end-to-end workflow for extracting motion information from recorded sprint footage. The centerpiece output is a continuous velocity-time series tracking the athlete’s acceleration and peak sprint speed.

Sprint Velocity vs. Time (10m Measured Segment)

Experimental output projected via 5-marker planar homography
Smoothed Trajectory
Raw Step Dynamics
10.0 m/s36 km/h7.5 m/s27 km/h5.0 m/s18 km/h2.5 m/s9 km/h0.0 m/s0.0s0.5s1.0s1.5s2.0s2.5s3.0s3.5sACCELERATION PHASE (0 - 1.5s)PEAK VELOCITY ZONE (1.5 - 2.7s)PEAK: 8.94 m/s32.18 km/h (t = 2.15s)10m mark: 1.82s split
Peak Estimated Velocity8.94 m/sEquivalent to 32.2 km/h
10m Segment Split1.82 sTime between M1 (0m) and M5 (10m)
Initial Mean Acceleration4.91 m/s²Derived during 0.0s – 1.5s drive phase
Video Temporal Sampling30 FPS33.3ms sampling interval
06 — Technical Challenges

Engineering hurdles & measurement constraints

Transforming computer vision detections into reliable biomechanical metrics revealed several fundamental challenges that distinguish visual prototypes from calibrated measurement instruments.

Tracking Error

Consistent Athlete Tracking

Detecting an athlete independently in each frame is insufficient for velocity calculation. Occlusion from rapid limb swings, motion blur at 30 FPS, and bounding-box jitter introduce artificial instantaneous displacement. Temporal smoothing is critical to prevent tracking noise from multiplying quadratically into acceleration errors.

Geometry

Perspective Distortion & Homography

Planar homography operates under the mathematical assumption that all tracked points lie strictly on a flat 2D plane. However, a sprinter’s hip moves vertically with each stride cycle. This out-of-plane vertical oscillation projects false horizontal displacement when transformed through the ground homography.

Evaluation

Unvalidated Reference Ground Truth

The pipeline calculates mathematically consistent velocity estimates, but its numerical outputs have not been calibrated against laboratory reference hardware (e.g. laser speed guns or synchronized timing gates). The project serves as an exploratory prototype demonstrating feasibility rather than a certified biomechanical device.

Δ

Scientific Note on Velocity Accuracy

In accordance with sound engineering standards, we avoid claims of “real-time analysis” or “certified accuracy.” Video inference was executed offline on recorded footage, and physical velocity values represent research estimates subject to camera lens calibration, frame-rate precision, and planar projection approximations.

07 — Key Learnings

From computer vision outputs to meaningful measurements

Key architectural takeaways gained while bridging deep learning models with projective geometry.

Takeaway 01

Machine Learning Needs Geometric Reasoning

Pretrained models like YOLO and MediaPipe excel at pixel-space recognition, but image coordinates alone cannot measure physical mechanics. Rigorous calibration, homography matrices, and camera geometry are essential to convert abstract bounding boxes into metric reality.

Takeaway 02

Temporal Stability Over Single-Frame Precision

A 95% single-frame detection accuracy is worthless if the identity or bounding-box anchor jitters by 4 pixels every frame. In kinematics, taking the derivative of noisy position signals amplifies high-frequency noise, making tracking smoothness far more critical than raw detection confidence.

Takeaway 03

Planar Assumptions in 3D Human Motion

Standard planar homography assumes tracked objects touch the ground. Tracking an anatomical landmark located ~1 meter above ground (the hip) introduces perspective parallax that varies with camera height and distance, highlighting the need for 3D body modeling in future iterations.

Takeaway 04

Pipeline Functionality vs. Real-World Validation

Demonstrating a functional end-to-end code pipeline is only the first step. Validating its reliability for coaches and athletes demands rigorous sensitivity analysis against professional timing gates and high-speed motion capture.

08 — Repository & Technologies

Explore the implementation

The repository contains the modular video processing pipeline, calibration algorithms, experiment notebooks, and sample analysis outputs.

Collaborative Research Project2023 – 2024

RunRightAI originated as a collaborative research exploration, forked from the foundational repository AyoubFrihaoui/HumanPose-Estimation-in-Sport-Analysis. Mohammed Hachoud specifically designed, developed, and led the 5-marker spatial calibration workflow, SAHI small-object inference integration, image-to-ground-plane homography projection, and numerical velocity-time series estimation pipeline.

Computer Vision Stack

Vision & Geometry

YOLOv8 for athlete person detection · MediaPipe Pose for 33-point joint landmark extraction · SAHI for sliced inference on small cones · OpenCV for homography estimation and image perspective warping.

Numerical Stack

Computation & Plotting

Python 3.10+ · NumPy for vector kinematics and matrix transformations · Pandas for time-series aggregation · Matplotlib & SciPy for Savitzky-Golay filtering and velocity curve rendering.