A powerful and intuitive real-time facial emotion detection system using OpenCV and MediaPipe. Detects emotions such as Happy, Sad, Angry, Fear, and Neutral from live webcam video feeds 🎥 — with smooth performance and high accuracy.
✅ Real-time emotion detection from your webcam.
😀 Detects 4 core emotions: Happy, Sad, Angry, Neutral.
📊 Displays confidence/probability for each emotion.
😄 High accuracy for smile/happy detection.
🎛️ Clean UI with dynamic confidence bars.
⚡ Real-time FPS (Frames Per Second) counter for performance monitoring.
- Python 3.7 or above 🐍
- Functional Webcam 🎥
- Libraries listed in
requirements.txt
- Clone the repository 📥
git clone https://github.com/your-username/real-time-emotion-detector.git cd real-time-emotion-detector - Install required packages 📦
pip install -r requirements.txt
- Run the application 💻
python main.py
- Your webcam will activate and begin real-time emotion detection 🧠
- Press 'q' to quit the application ❌
This system uses a hybrid approach combining facial geometry with fallback image analysis:
🔍 Powered by MediaPipe Face Mesh to detect and track 468 facial landmarks in real-time.
Analyzes geometrical features like:
- 👄 Mouth shape and curvature (key for detecting smiles)
- 👁 Eye aspect ratio
- 🙄 Eyebrow positioning
- 😊 Cheek area landmarks
When landmark detection is weak, the system uses:
- 🖍 Edge detection in facial regions
- 💡 Brightness/intensity patterns
- 🔲 Region-based texture analysis
- Works best in good lighting conditions 💡
- Accuracy may vary depending on webcam quality 📸