A real-time smile detection web application built with OpenCV, MediaPipe, and FastAPI. The app uses a webcam to detect faces and determine whether the user is smiling, displaying the results on a frontend built with vanila HTML/CSS.
- Real-time face and smile detection
- Accurate results using MediaPipe's face mesh
- Lightweight and fast performance via FastAPI backend
- Simple and clean web interface using HTML & CSS
- Project also includes files for detecting Faces and Hands.
- Python
opencv-python
(cv2
) for video capture and image processingmediapipe
for face mesh and smile detection logic, also tracks and detects lips.fastapi
for serving the backend and APIs
- Frontend
HTML
andCSS
for UI layout and styling
git clone https://github.com/Yeeyash/Smile-Detector-using-OpenCV.git
Start the FastAPI server:
uvicorn smilepage:app --reload
Then open your browser and navigate to:
http://127.0.0.1:8000
- OpenCV captures real-time video from the webcam.
- MediaPipe's face mesh model detects key facial landmarks. 3.A smile is detected by analyzing the distances and movement between key mouth landmarks.
- Results are streamed to the browser using FastAPI endpoints.
- The HTML/CSS frontend renders the webcam feed and updates smile status dynamically.
This project is licensed under the MIT License.