Giter VIP home page Giter VIP logo

sudhanshu1st / gesture_gaming Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 5 KB

This project allows you to control the popular game "Hill Climb Racing" using hand gestures captured by a webcam. The program utilizes the OpenCV library for hand tracking and gesture recognition, enabling you to steer the in-game vehicle by moving your hand.

Python 100.00%
computer-vision gaming opencv pythom3

gesture_gaming's Introduction

Gesture Control for Hill Climb Racing

Screenshot 2023-07-27 122033

This project allows you to control the popular game "Hill Climb Racing" using hand gestures captured by a webcam. The program utilizes the OpenCV library for hand tracking and gesture recognition, enabling you to steer the in-game vehicle by moving your hand.

Requirements

Before running the code, make sure you have the following libraries installed:

  • OpenCV (cv2)
  • CVZone (HandTrackingModule)
  • Pynput (keyboard)

You can install these libraries using pip:

pip install opencv-python
pip install cvzone
pip install pynput

How to Run

  1. Ensure that your webcam is properly connected to your computer.

  2. Download or copy the provided Python script to your local environment.

  3. Run the Python script:

    python your_file_name.py
    
  4. The webcam window will open, and the program will begin detecting your hand.

Hand Gesture Controls

The hand gestures recognized by the program correspond to the following actions in the game:

  1. Fist Gesture: Steer Left/ Break

    When you make a fist with your hand, the in-game vehicle will steer to the left.

  2. Five Fingers Gesture: Steer Right/ Accelerate

    When you open your hand with all five fingers extended, the in-game vehicle will steer to the right.

  3. Any Other Gesture or No Hand Detected: Neutral

    If you show any other hand gesture or if your hand is not detected, the vehicle will maintain a neutral position in the game.

Exiting the Program

To exit the program, press the "q" key while the webcam window is in focus. This will terminate the script and close the webcam feed.

Important Notes

  • Adjust the detectionCon and maxHands parameters in the HandDetector constructor based on your camera setup and hand recognition accuracy requirements.

  • Ensure that your environment has access to the required camera (usually the default webcam) to capture the video feed.

  • The success of the gesture control may vary depending on lighting conditions and the position of your hand in front of the camera.

Disclaimer

This project is intended for educational and personal use. Please make sure to use the gesture control responsibly and avoid any distractions while playing games. The authors of this project are not responsible for any misuse or accidents that may occur while using this code.

Have fun playing Hill Climb Racing with your hands!

gesture_gaming's People

Contributors

sudhanshu1st avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.