Welcome to Rock-Paper-Vision, a computer vision-based implementation of the classic Rock-Paper-Scissors game. This project uses OpenCV and CvZone's Hand Tracking Module to recognize hand gestures, enabling players to compete against an AI in real time.
- Real-time hand tracking: Detects gestures using your webcam.
- AI opponent: AI makes random moves for competitive gameplay.
- Interactive UI: Displays live scores and visual feedback with a custom background.
- Hand gestures supported:
- Rock: All fingers folded.
- Paper: All fingers open.
- Scissors: Only index and middle fingers open.
- Hand Tracking:
- Uses
cvzone.HandTrackingModule
for detecting and interpreting hand gestures.
- Uses
- Gameplay:
- Recognizes the player's gesture.
- Generates a random AI move.
- Compares gestures to determine the winner based on traditional rules:
- Rock beats Scissors.
- Scissors beats Paper.
- Paper beats Rock.
- Scoring:
- Updates and displays the score for both player and AI in real time.
- Visual feedback enhances the game experience.
- Python 3.8 or higher
- Libraries (install via
pip
):pip install opencv-python cvzone
git clone https://github.com/cyberfantics/Rock-Paper-Vision.git
cd Rock-Paper-Vision
python main.py
- Play: Press
P
to start the game. - Quit: Press
Q
to exit the game. - Restart: Press
R
to restart the game. - Record Game: Press
S
to record the Game. - Open Camera: Press
C
to Open Camera. - Record Game: Press
I
to See Instructions Of Game.
Check out the gameplay video on YouTube:
Syed Mansoor ul Hassan Bukhari
GitHub | LinkedIn
Enjoy the game! 🎮