MediaPipe hand-landmark gesture controls for computer volume.
- Open the pinch between thumb and index finger: higher volume percentage
- Close the pinch between thumb and index finger: lower volume percentage
- The current volume is displayed as a number on screen.
- Only MediaPipe-detected hands are accepted, so faces are ignored.
- The default accepted hand is
right.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python download_model.pyOn macOS, allow Terminal or your Python app to access:
- Camera
- Accessibility
Those permissions are needed so the app can see your hand and change volume.
Start in dry-run mode first. It prints the action instead of controlling your computer.
python gesture_control.py --dry-runThen run the real controls:
python gesture_control.pyPress q in the camera window to quit.
If you want to use the left hand:
python gesture_control.py --dry-run --hand leftGesture thresholds are intentionally conservative to reduce accidental triggers. If commands feel too slow or too sensitive, tune these values in gesture_control.py:
- Closed pinch ratio:
0.25 - Open pinch ratio:
1.55 - Minimum volume update:
2