AI & intelligence / PROJECT NOTES
Gesture-Controlled Flappy Bird
A Flappy Bird game controlled by hand gestures using computer vision
01 / OVERVIEW
The idea behind it.
This project implements a Flappy Bird game that can be controlled using hand gestures. It uses computer vision to detect hand movements and translates them into game controls. The game features real-time gesture recognition and smooth gameplay mechanics.
02 / FEATURES
What it does.
- 01Real-time hand gesture detection
- 02Smooth game controls
- 03Customizable difficulty levels
- 04Score tracking system
03 / CHALLENGES
The problems worth solving.
- 01Implementing accurate gesture recognition
- 02Optimizing performance for real-time processing
- 03Creating intuitive game controls
04 / LEARNINGS
What I took away.
- 01Computer vision fundamentals with OpenCV
- 02Real-time processing optimization techniques
- 03Game development with Pygame
- 04Hand tracking implementation using MediaPipe
- 05Installation requirements:
- 06 - Python 3.9+
- 07 - Required libraries:
- 08 * opencv-python
- 09 * mediapipe
- 10 * face_recognition
- 11 * numpy
- 12 * requests
- 13 - Installation command:
- 14 pip install opencv-python mediapipe face_recognition numpy requests
Project resources.
# Setup and Running Instructions ## 1. Create and Activate Virtual Environment ```bash # Create a new virtual environment python -m venv venv # Activate the virtual environment # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate ``` ## 2. Install Required Packages ```bash # Install all required packages pip install opencv-python mediapipe face_recognition numpy requests pygame ``` ## 3. Download Required Assets Make sure you have the following files in your project directory: - bird.png - building.png - voice.mp3 ## 4. Running the Application You'll need to run two Python scripts simultaneously in separate terminals: ### Terminal 1 - Gesture Detection ```bash # Make sure you're in the virtual environment source venv/bin/activate # On macOS/Linux # or venv\Scripts\activate # On Windows # Run the gesture detection script python video.py ``` ### Terminal 2 - Game ```bash # Make sure you're in the virtual environment source venv/bin/activate # On macOS/Linux # or venv\Scripts\activate # On Windows # Run the game python game.py ``` ## Troubleshooting 1. If you get a "No module named 'cv2'" error: - Make sure you activated the virtual environment - Try reinstalling opencv-python: `pip install --upgrade opencv-python` 2. If the game doesn't respond to gestures: - Make sure both scripts are running - Check if the action.txt file is being created and updated - Ensure your webcam is working properly 3. If you get pygame errors: - Make sure all image files (bird.png, building.png) are in the correct directory - Check if the voice.mp3 file exists ## Notes - The game uses your webcam for gesture detection - Press ESC in the gesture detection window to exit - Close the game window to stop the game - The game difficulty increases as you score more points
KEEP EXPLORING