Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Hand Gesture Game Control 🎮✋

This project allows you to control games using hand gestures detected via a webcam. It uses OpenCV, MediaPipe, and PyAutoGUI to recognize finger positions and simulate keyboard presses.

✨ Features

  • Detects hand gestures in real-time using your webcam.

  • Maps specific gestures to game controls:

    • Index finger up → Move Right ()
    • Index + Middle finger up → Move Left ()
    • Thumb + Index + Middle up → Jump ()
    • No fingers up (fist) → Slide ()
    • All fingers up → Idle (no action)

🛠️ Requirements

Make sure you have Python installed. Then install the following libraries:

pip install opencv-python mediapipe pyautogui

▶️ How to Run

  1. Clone this repository or download the code.

  2. Run the script:

    python hand_gesture_control.py
  3. Show your hand in front of the webcam and start controlling your game!

📌 Controls (Gestures → Keys)

Gesture Action Key Pressed
☝️ Index finger up Move Right
✌️ Index + Middle up Move Left
👍 + ☝️ + ✌️ (Thumb + Index + Middle up) Jump
✊ Fist (No fingers up) Slide
✋ All fingers up Idle None

⚠️ Notes

  • Works best in good lighting.
  • Keep only one hand in the camera frame.
  • Some games may require different key mappings (you can edit in the code).

About

This code can be used to control the subway surfers game through the opencv project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages