This Python script uses your webcam to detect your facial expressions and hand gestures in real-time, displaying a corresponding image of Cristiano Ronaldo that matches your "mood."
React like Ronaldo and see the program respond!
- Real-time Detection: Uses OpenCV for video capture and MediaPipe for high-performance face and hand landmark tracking.
- Multiple States: Detects three different "Ronaldo moods":
- 😄 SIUU: Detected when you make a round 'O' shape with your lips (like shouting "Siuu!").
- 🖐️ FIVE_CHAMPIONS: Detected when you show an open palm (five fingers) to the camera.
- 😐 SERIOUS: The default state when no other gesture is detected.
- Side-by-Side Display: Shows your live camera feed next to the corresponding Ronaldo reaction image in a single window.
- Assets Included: The necessary reaction images (
serious.jpg,siuu.jpg,five_champions.jpg) are included in theronaldo_imagesfolder.
- Python 3.x
- A webcam
- All dependencies listed in
requirements.txt.
-
Clone the repository
git clone https://github.com/xPieroxk/cr7_mood_reactor.git cd cr7_mood_reactor -
Install the required libraries
It's recommended to use a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use: venv\Scripts\activate
Install dependencies from
requirements.txt:pip install -r requirements.txt
If a
requirements.txtfile is not available, you can install the core dependencies manually:pip install opencv-python numpy mediapipe
-
Make sure your webcam is connected and all dependencies are installed.
-
Run the Python script from your terminal:
python ronaldo_mood_detector.py
-
A window titled "Ronaldo Detector" will open.
- Your camera feed will be on the left.
- The Ronaldo mood image will be on the right.
-
Try the gestures!
- Make a round 'O' shape with your lips to trigger the SIUU state.
- Hold up an open hand (five fingers) to trigger the FIVE_CHAMPIONS state.
-
Press 'q' or 'Esc' to quit the application.
You can modify the global constants at the top of the script to change its behavior:
WINDOW_WIDTH = 1280: Sets the total width of the application window.WINDOW_HEIGHT = 480: Sets the height of the application window.RONALDO_IMAGES = "ronaldo_images": The name of the folder containing the reaction images.MIRROR_CAMERA = True: Set toTruefor a "selfie view" mirror effect. Set toFalsefor a true, non-mirrored view.