← All posts

Handstand Tracker: What It Takes to Tell a Computer You Are Upside Down

2024CV · Python

LeverLens tracked elbow levers from above. Handstands have the same problem in reverse. You cannot see your own form when you are upside down. A webcam pointed at your feet is the closest thing to a mirror.

The Handstand Tracker is the inverted sibling of LeverLens. It uses MediaPipe Pose to detect when your body is upside down, measures arm angles, estimates height off the ground, and times how long you hold the position. OpenCV shows the feed. Pygame shows the numbers.

The Inversion Check

MediaPipe landmark coordinates increase Y as they go down the frame. When a person is standing normally, shoulders have a higher Y value than hips. In a handstand, shoulders are above hips and the Y comparison flips.

The check is simple. Average shoulder Y compared to average hip Y with a small threshold. If shoulders are above hips by enough, you are inverted. The threshold of 0.2 is a fixed value. It works for a centered camera and a straight body, but it is not adaptive to different setups.

The Measurements

The hand angle uses three landmarks: left wrist, left shoulder, and right shoulder. The angle between wrist and the shoulder line tells you how far your arms are from vertical. A straighter line means a more aligned handstand.

The height is a proxy. It averages the wrist y-coordinates and converts them from normalized values to pixels. The number is relative to the camera frame, not the actual ground. It gives a general sense of elevation without needing real measurement.

The timer starts when the inversion check passes and resets when the body drops. No pause. No cumulative tracking per session.

What I Would Change

The threshold is hardcoded. A taller person or a different camera angle would need a different value. I would derive it from the user proportions or add a calibration step.

The height measurement is relative to the frame, not the ground. It shifts if the user walks closer or farther from the camera. A reference object at a known distance would fix that.

The timer resets completely instead of tracking total handstand time across a session. That makes it a stopwatch, not a training log. I would add session-level persistence and history.

It is a companion to LeverLens, and it shows. The same architecture, the same limitations, and the same single-purpose focus. A webcam, 133 lines, and one question. Are you upside down and how long can you stay there.

View all projects →View on GitHub ↗