Hand Gesture Recognition
Real-time hand and gesture recognition from camera input, being built as a control and interaction layer for the Quadruped Robot Platform.
Overview
I wanted a hands-free way to give commands to the quadruped robot I’m building, so I started with something I could test every day: controlling my Mac’s mouse with nothing but a webcam and my hand. The same tracking and gesture logic will later run on a Linux board on the robot and turn hand signals into movement commands.
What I built
- Live webcam capture with OpenCV, passed through MediaPipe Hands to find 21 landmarks on the hand in every frame.
- Cursor control mapped from camera space to screen space, with smoothing and an ignored edge margin so you can reach the corners of the screen without leaving the frame.
- Pinch to click, with a double-pinch for double-click and a cooldown so one pinch never fires twice.
- Open-palm scroll mode: hold all four fingers up and move your hand up or down from an anchor point to scroll, with a dead zone so small movements don’t scroll.
Challenges & lessons
The tutorial I followed was a few years old, and the current Python (3.14) no longer had mediapipe.solutions, so I set up a Python 3.11 environment to match it. The bigger problem was clicking. The cursor followed my index fingertip, so pinching moved the cursor and the click missed. I switched tracking to the index knuckle, which stays still while you pinch, and froze the cursor until your fingers separate. Scroll mode also flickered on and off until I required the gesture to be held for a few frames before switching.