Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

VenkatLaxmi-code/HandGesture-Game

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gesture Surfer — Control Subway Surfers with Hand Gestures

This project lets you play Subway Surfers (web or desktop) using simple hand gestures captured from your webcam. It uses OpenCV (video), MediaPipe Hands (gesture landmarks), and PyAutoGUI (to press keys).

Quick Start

  1. Create and activate a virtual environment (recommended):

Windows (PowerShell):

py -3 -m venv .venv
.\.venv\Scripts\Activate

macOS/Linux (bash):

python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Launch the script:
python gesture_surfer.py
  1. Focus the Subway Surfers game window (browser tab or app). Keep the webcam in view.

Default Gestures → Game Actions

  • Swipe Right (fast index fingertip move to the right) → Press Right Arrow (change lane right)
  • Swipe Left (fast index fingertip move to the left) → Press Left Arrow (change lane left)
  • Open Palm (all five fingers up) → Press Up Arrow (jump)
  • Fist (no fingers up) → Press Down Arrow (roll/slide)

Tips

  • Gestures trigger once and then enter a short cooldown to avoid repeats.
  • Make gestures clearly within the camera view and roughly centered.
  • You can adjust thresholds near the top of gesture_surfer.py for sensitivity and cooldown.

Troubleshooting

  • If nothing happens, ensure the game window is focused (click it once).
  • If your cursor moves unexpectedly, PyAutoGUI might be failing due to permissions (macOS Accessibility permission).
    • On macOS, add your terminal/IDE to System Settings → Privacy & Security → Accessibility.
  • If the webcam is wrong, change CAM_INDEX in gesture_surfer.py (0, 1, 2…).
  • If MediaPipe fails to install on Apple Silicon, try:
    pip install --upgrade pip setuptools wheel
    pip install mediapipe

Safety Note

PyAutoGUI sends real key presses to the active application. Always keep control of the environment when running the script.

Gesture Surfer — Control Subway Surfers with Hand Gestures

This project lets you play Subway Surfers (web or desktop) using simple hand gestures captured from your webcam. It uses OpenCV (video), MediaPipe Hands (gesture landmarks), and PyAutoGUI (to press keys).

📸 Demo

Hand Gesture Game

👨‍💻 Author

Venkat Laxmi Gottam

⭐ If you like this project, don’t forget to star the repo!

About

Computer Vision game controller that uses OpenCV and MediaPipe hand gestures to play Subway Surfers through webcam input.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.