![Screenshot 2023-07-27 122033](https://private-user-images.githubusercontent.com/109865453/256713654-1dcd0acb-3095-4fe7-bf05-007773153fb3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYwMTUxNzMsIm5iZiI6MTcyNjAxNDg3MywicGF0aCI6Ii8xMDk4NjU0NTMvMjU2NzEzNjU0LTFkY2QwYWNiLTMwOTUtNGZlNy1iZjA1LTAwNzc3MzE1M2ZiMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMVQwMDM0MzNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00MWZmMmVlYmU2YzdmMDMyNmIzMzg4MGU1MGFkZGU5NGY1N2RkMDViZDA4OTBlMWY0MDI3NTA3N2UyMjZhYTM5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.PH5NemrFYLp2YDD7g9QgbwsEijxckE2SNnedAENCOQY)
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.
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
-
Ensure that your webcam is properly connected to your computer.
-
Download or copy the provided Python script to your local environment.
-
Run the Python script:
python your_file_name.py
-
The webcam window will open, and the program will begin detecting your hand.
The hand gestures recognized by the program correspond to the following actions in the game:
-
Fist Gesture: Steer Left/ Break
When you make a fist with your hand, the in-game vehicle will steer to the left.
-
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.
-
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.
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.
-
Adjust the
detectionCon
andmaxHands
parameters in theHandDetector
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.
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!