rps-gesture-detector
is a computer vision-based game that allows users to play Rock-Paper-Scissors by showing hand gestures in front of a webcam. Built with Python and OpenCV, the system processes the live video stream, detects the user's gesture, and determines the winner by generating a gesture from the AI.
- Real-time hand gesture detection
- Background removal and preprocessing visualization
- Classic Rock-Paper-Scissors game logic
- AI opponent with random move generation
- User-friendly and responsive interface
- Optionally extendable to RPSLS (Lizard & Spock)
- Python
- OpenCV
- NumPy
- Tkinter
Follow these steps to set up the project on your local machine:
-
Clone the Repository
Clone this repository to your local machine using Git:git clone https://github.com/your-username/rpsls-gesture-detector.git cd rpsls-gesture-detector
-
Set Up a Virtual Environment
Create and activate a Python virtual environment to isolate dependencies:python -m venv .venv
-
On Windows:
.venv\Scripts\activate
-
On macOS/Linux:
source .venv/bin/activate
-
-
Install Dependencies
Install the required Python packages listed inrequirements.txt
:pip install -r requirements.txt
-
Configure Environment Variables (Windows Only)
If you encounter issues withtkinter
, set theTCL_LIBRARY
environment variable:$env:TCL_LIBRARY="C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python313\tcl\tcl8.6"
-
Run the Application
Start the Rock-Paper-Scissors gesture detector:python main.py
You're all set! Enjoy playing Rock-Paper-Scissors with gesture detection! 🎮🖐️