This project is a real-time face, eye, and smile detection system built using Python and OpenCV. It uses Haar Cascade Classifiers to detect facial features from a live webcam feed.
- 🎯 Real-time face detection
- 👀 Detects eyes inside the detected face region
- 😄 Detects smiles inside the detected face region
- 📷 Uses webcam feed
- 🖼️ Draws bounding boxes and displays detection text
- Python
- OpenCV
- Haar Cascade Classifiers
Face-Eyes-Smile-Detection/
│
├── haarcascade_frontalface_default.xml
├── haarcascade_eye.xml
├── haarcascade_smile.xml
├── main.py
└── README.md
⚠️ Make sure the Haar cascade XML files are placed in the correct directory as referenced in the code.
Install the required dependency using pip:
pip install opencv-python- Clone the repository or download the project files.
- Ensure your webcam is connected.
- Update the Haar cascade file paths if needed.
- Run the script:
python face_eye_smile_detection.py- Press
qto exit the application.
- Captures video frames from the webcam.
- Converts each frame to grayscale for better detection.
- Detects faces using
haarcascade_frontalface_default.xml. - Defines a Region of Interest (ROI) for each face.
- Detects eyes and smiles within the ROI.
- Displays detection results on the video feed.
- Detection accuracy depends on lighting conditions.
- Haar cascades work best with frontal faces.
- Smile detection may require fine-tuning parameters for better accuracy.
This project is open-source and free to use for educational purposes.


