Skip to content

BrnGuenther/handsign_gaming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playing FireBoy and WaterGirl using Hand Sign Recognition

alt text

This is a simple project for personal study on using popular computer vision libraries and open-source ML models.

  • OpenCV is used for webcam connection and drawing hand landmarks.
  • MediaPipe is used for machine learning.
  • PyAutoGUI is used for inputting keyboard commands.

How to Play

  • Clone this repository.
  • Install the required packages using pip install -r requirements.txt.
  • Run main.py.
  • Open the game on any website using your browser.
  • Make sure to select your browser window with the OpenCV video running.
  • Give hand signs to move the characters.

Commands

Your right hand is supposed to send commands to WaterGirl, controlling "wsd" keys with the following mapping:

  • ☝️ Pointing Up for d (Running to the right)
  • ✌️ Victory sign for a (Running to the left)
  • ✊ Closed Fist for w (Jumping)
  • ✋ Open Palm to cancel all movement (Stop)

Your left hand is supposed to send commands to FireBoy, controlling "→←↑" keys with:

  • ☝️ Pointing Up for (Running to the right)
  • ✌️ Victory sign for (Running to the left)
  • ✊ Closed Fist for (Jumping)
  • ✋ Open Palm to cancel all movement (Stop)

If you want to change which hand controls which character, you need to hard-code the keys passed to PyAutoGUI's KeyDown and KeyUp methods.

Useful Information

The parameter pyautogui.PAUSE = 0 is needed to eliminate the delay that PyAutoGUI automatically implements to prevent mouse lock when automating mouse clicks.

You can find information about the "gesture_recognizer.task" ML model directly in this link: https://ai.google.dev/edge/mediapipe/solutions/vision/gesture_recognizer

Documentation

About

Using Computer Vision libraries and open-source ML models to play FireBoy and Watergirl on browser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages