Welcome to the Fruit Ninja Game implemented using OpenCV! This project recreates the classic Fruit Ninja game, where players slice fruits that appear on the screen. The game uses computer vision techniques to detect the player's hand gestures or mouse movements to simulate the slicing action.
#Table of Contents -Features -Tech Stack -Gameplay -Installation -Usage -Contributing -License -Contact -Features
- Gesture Detection: Use hand gestures to slice fruits (requires a webcam).
- Mouse Control: Use the mouse as an alternative to gestures.
- Fruit Variety: Multiple types of fruits with different slicing effects.
- Score Tracking: Keep track of your score as you slice fruits.
- Visual Effects: Realistic fruit slicing animations and effects.
Programming Language: Python Computer Vision: OpenCV Graphics: Pygame (for rendering and animations)
In the game, fruits are thrown onto the screen, and the player must slice them by moving their hand (detected via a webcam) or using the mouse. The player scores points for each fruit sliced, and the game continues until a certain number of fruits are missed.
Prerequisites Python 3.6+ Webcam (for gesture detection) Setup
Copy code git clone https://github.com/your-username/fruit-ninja-opencv.git cd fruit-ninja-opencv Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows use venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt Usage Run the game:
python main.py
Gesture Mode: Use your hand gestures to slice the fruits (requires a webcam). Mouse Mode: Move the mouse to slice the fruits.
Slice as many fruits as possible without missing too many. Some fruits may have special effects or bonuses. Contributing We welcome contributions! Please read our Contributing Guidelines for more details.
This project is licensed under the MIT License - see the LICENSE file for details.