Back to previous page

Built at the 7th International Summer School on AI and Games

Hand Gesture Detector

MediaPipe · JavaScript · Python · OpenCV · June 2025

Run live demo (opens in a new tab)

At the 7th International Summer School on Artificial Intelligence and Games (Malmö, Sweden, June 2025), I built a hand gesture detector that runs live in the browser. Each webcam frame goes through MediaPipe's pretrained Hand Landmarker, which finds the palm and places 21 landmarks on the hand. Hand-written finger geometry and a JSON file of rules then turn those points into one of five gestures, with no training.

The pipeline on an illustrative drawn hand, evaluated with the demo's own code: the pretrained model, the finger geometry and the rules. Music and sound effects: original, synthesized for this video.

For each finger, the detector checks whether it is stretched (both joints within 30° of straight) and whether it points up (its tip more than 0.05 of the image height above its knuckle). It also measures the angle between each finger and the thumb, seen from the wrist, and the overall tilt of the hand. The rules in rules.json are checked in order, and the first match wins: defend, attack, fire, grass and water. The same logic runs in the browser with MediaPipe Tasks (WebAssembly) and in Python with OpenCV.