A real-time camera-based emoji display application that uses MediaPipe to detect your poses and facial expressions, then displays the corresponding emoji in a separate window.
- Hand Detection: Raise a hand above your shoulder → displays hands up emoji 🙌
- Tongue Out Detection: Stick your tongue out → displays tongue emoji 😛
- Side Eye Detection: Turn your head sideways → displays side eye emoji 🙄
- Smile Detection: Show your teeth → displays smiling emoji 😊
- Default State: Straight face → displays neutral emoji 😐
- Real-time Processing: Live camera feed with instant emoji reactions
- Hands Up (highest priority) — overrides all facial expression detection
- Tongue Out — detected when tongue tip extends past lower lip
- Side Eye — detected when nose offset from face center exceeds threshold
- Smiling — detected via brightness of the mouth region (teeth visible)
- Straight Face — default when none of the above are triggered
- Python 3.12
- A webcam
- Required Python packages (see
requirements.txt)
pip install -r requirements.txtpython emoji_reactor3.py- Run the script — your webcam starts immediately.
- Two windows will open:
- Camera Feed: Shows your live camera with the current detection state overlaid
- Emoji Output: Displays the corresponding emoji based on your expression or pose
- Controls:
- Press
qto quit the application - Raise a hand above your shoulder for the hands up emoji 🙌
- Stick your tongue out for the tongue emoji 😛
- Turn your head to trigger the side eye emoji 🙄
- Show your teeth / smile for the smiling emoji 😊
- Keep a straight face for the neutral emoji 😐
- Press
The application uses two MediaPipe solutions running in parallel each frame:
- Pose Detection — Monitors shoulder and wrist landmark positions to detect raised hands
- Face Mesh Detection — Analyzes 468 facial landmarks to detect expressions:
- Teeth/Smile: Measures average pixel brightness of the mouth bounding box region
- Tongue Out: Measures the distance from tongue-tip landmark to lower lip midpoint
- Side Eye: Measures horizontal offset of the nose tip from the midpoint between both outer eye corners
Edit the threshold constants at the top of emoji_reactor3.py:
| Constant | Default | Effect |
|---|---|---|
SMILE_THRESHOLD |
0.22 |
Mouth aspect ratio for smile detection |
HEAD_TURN_THRESHOLD |
0.04 |
Nose offset for side-eye trigger |
TONGUE_THRESHOLD |
0.04 |
Tongue-tip distance for tongue-out trigger |
TEETH_BRIGHTNESS_THRESHOLD |
120 |
Pixel brightness to detect visible teeth |
Replace the image files in the project root with your own:
| File | Emoji | State |
|---|---|---|
smile.jpg |
😊 | Smiling with teeth |
plain.png |
😐 | Straight / neutral face |
air.jpg |
🙌 | Hands raised up |
tongue.jpg |
😛 | Tongue out |
sideye.jpeg |
🙄 | Head turned / side eye |
| File | Features |
|---|---|
emoji_reactor.py |
v1 — Smile + Hands Up only |
emoji_reactor2.py |
v2 — Added Side Eye + Tongue Out (ratio-based) |
emoji_reactor3.py |
v3 ✅ Latest — Improved smile via teeth brightness detection |
- Uses OpenCV for camera capture and window display
- Uses MediaPipe Pose (33 landmarks) for hand/shoulder tracking
- Uses MediaPipe FaceMesh (468 landmarks) for facial expression detection
- Frames are converted to RGB before MediaPipe processing, then back to BGR for display
opencv-python— Computer vision and camera capturemediapipe— Pose and Face Mesh landmark detectionnumpy— Numerical computing for landmark geometry
See requirements.txt for version constraints and requirements-lock.txt for pinned versions.
MIT License — see LICENSE for details.
