Physical therapy and rehabilitation exercises often require high degrees of consistency in posture and joint angles that patients struggle to self-evaluate at home without specialized equipment.
Tracking 33 3D Keypoints in Real-Time
By utilizing MediaPipe Pose models in the browser via WebAssembly and WebGL pipelines, we achieved consistent 60 FPS skeletal landmark extraction on standard laptop cameras.
Calculating Vector Angles
Joint angles (such as elbow flexion or knee extension) are computed in real time using 3D Euclidean coordinates:
javascript
function calculateAngle(a, b, c) {
const radians = Math.atan2(c.y - b.y, c.x - b.x) - Math.atan2(a.y - b.y, a.x - b.x);
let angle = Math.abs((radians * 180.0) / Math.PI);
if (angle > 180.0) angle = 360.0 - angle;
return angle;
}This simple yet robust formulation powers repetition counters, form deviation feedback, and accessible fitness routines without any wearables.