A real-time camera-based emoji display application powered by MediaPipe to detect poses and facial expressions.
Emoji Reactor is a computer vision application that creates an interactive, real-time emoji reaction experience. It leverages your webcam and the highly efficient MediaPipe framework to detect specific body poses and facial expressions, instantly displaying a corresponding emoji in a separate window. Whether you're smiling, throwing your hands up, or creating custom gestures, Emoji Reactor brings your expressions to life on screen!
- 🙌 Hand Detection: Raise your hands above your shoulders to display the "hands up" emoji.
- 😊 Smile Detection: Show your pearly whites to trigger the "smiling" emoji.
- 😐 Default State: Keep a straight face to maintain a neutral emoji.
- ⚡ Real-time Processing: Experience zero-lag live camera feed tracking and instant emoji outputs.
- 🎨 Custom Emojis: Includes custom additions like a jawline emote (
jawline.png) and the 67 Clash Royale emote (67clashroyale.webp).
- Python - Core programming language.
- OpenCV - High-performance computer vision library for camera capture and display.
- MediaPipe - Robust machine learning solutions for Pose and Face Mesh detection.
- NumPy - Fundamental package for numerical computing.
Follow these steps to get a local copy up and running.
- Python 3.12 or newer.
- macOS (Homebrew):
brew install python@3.12
- macOS (Homebrew):
- A functional webcam.
-
Clone the repository:
git clone https://github.com/sandeepannandi/Emoji-Detector.git cd Emoji-Detector -
Set up a virtual environment:
python3.12 -m venv emoji_env source emoji_env/bin/activate # On Windows, use `emoji_env\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Prepare Emoji Assets: Ensure the following image assets are present in the project directory:
smile.jpgplain.pngair.jpgjawline.png67clashroyale.webp
Start the application by running the following command:
# Option A: Using the helper script (macOS/Linux)
./run.sh
# Option B: Running manually
source emoji_env/bin/activate
python emoji_reactor.pyUpon launch, two windows will appear:
- Camera Feed: Your live view with detection overlays highlighting identified landmarks.
- Emoji Output: The blank canvas where your real-time emoji reactions will appear.
Controls:
- Raise your hands above your shoulders → 🙌
- Smile → 😊
- Express other custom gestures like jawline flex or the 67 meme movements!
- Press
qto quit the application gracefully.
- Hands Up - Overrides facial expressions.
- Smiling - Activated when the mouth aspect ratio exceeds the defined threshold.
- Straight Face - Fallback default state.
- Custom Gestures - E.g. Jawline flex, 67 Emote.
To fine-tune smile recognition, edit the SMILE_THRESHOLD constant in emoji_reactor.py:
- Decrease (e.g.,
0.30) to make it easier to trigger a smile. - Increase (e.g.,
0.40) to reduce false positive smile detections.
Easily replace the default images with your own by over-writing the corresponding files (smile.jpg, plain.png, air.jpg, etc.) with files of the exact same name and extension.
macOS Camera Access Denied
If you receive a "Not authorized to capture video" error:
- Open System Settings > Privacy & Security > Camera.
- Toggle permissions ON for your Terminal / VS Code / iTerm.
- Restart your terminal completely.
Detection Issues
- Visibility: Ensure your face and arms are clearly visible within the frame.
- Lighting: Bright, even lighting significantly improves detection accuracy.
- Camera Index: If the app uses the wrong camera, edit
emoji_reactor.pyand changecv2.VideoCapture(0)tocv2.VideoCapture(1)(or another index).
Distributed under the MIT License. See LICENSE for more information.