A gesture-based virtual cricket game where players can bat and bowl using hand gestures via webcam — no keyboard or controller needed! Built using MediaPipe, OpenCV, and a custom-trained Random Forest model.
- ⚡ Real-time gesture recognition using webcam
- 🤝 Two-player interactive gameplay
- 🧠 Machine learning model trained on hand landmarks
- 🕹️ Toss logic with batting or bowling decision
- 🏏 Two full innings, including out detection
- 📊 Automatic match result computation
- Hand Gesture Recognition: MediaPipe detects hand landmarks; the model classifies gestures into
0,1,2,3,4,6, orclosed. - Toss: One player calls head/tail, toss is simulated.
- Bat/Bowl Choice: Toss winner chooses to bat or bowl.
- Gameplay:
- Both players show their gesture simultaneously.
- If gestures match → OUT
- Else → Runs are added from batter’s gesture.
- Game plays for up to 6 valid inputs or until batter gets out.
- Python 🐍
- MediaPipe ✋ (Hand tracking)
- OpenCV 🎥 (Camera feed + annotations)
- Scikit-learn 🤖 (Random Forest Classifier)
- Multiprocessing 🔁 (Simultaneous gesture capture from 2 players)
- Cloning the repository
git clone https://github.com/your-username/gesture-cricket.git
cd gesture-cricket- Creating and activating the environment
# Create a virtual environment
python -m venv env
# Activate it
source env/bin/activate- Installing the dependencies
pip install -r requirements.txt- Running the game
python app.py