The Viola-Jones object detection framework, introduced in 2001 by Paul Viola and Michael Jones, represents a breakthrough in the field of Computer Vision (CV), particularly in the domain of real-time face detection.
This Python script implements the Viola-Jones face detection algorithm using OpenCV for face, eye, and mouth detection. The program captures video from a webcam, processes each frame for face detection, and displays the live feed with bounding boxes around detected faces, eyes, and mouths.
The Viola-Jones algorithm is a popular method for real-time object detection, particularly for faces. This project aims to provide a simple implementation of the algorithm using Python and OpenCV, making it accessible for educational purposes, prototyping, or integration into larger projects. Face detection has various applications, including security systems, human-computer interaction, and biometric identification.
- Python 3.x
- OpenCV (cv2)
- Tkinter (for GUI)
- macOS or Linux (for dynamic path handling)
- Install Python 3.x from python.org.
- Install OpenCV:
pip install opencv-python
- Install Tkinter (included in Python standard library).
- Clone or download the script to your local machine.
git clone https://github.com/AFLucas-UOM/ICS2207-Viola-Jones
- Run the script using Python:
python Viola-Jones.py
- Ensure that your webcam is connected and accessible.
- The program will display the live webcam feed with face, eye, and mouth detection bounding boxes.
- Press the 'q' key to exit the program.
- Utilizes the Viola-Jones algorithm for real-time face detection.
- Detects eyes and mouths within detected faces.
- Provides a simple GUI with an exit confirmation dialog.
Viola-Jones.py
: Main Python script implementing the Viola-Jones algorithm.haarcascade_frontalface_default.xml
: Pre-trained Haar cascade XML file for face detection.haarcascade_eye.xml
: Pre-trained Haar cascade XML file for eye detection.haarcascade_mcs_mouth.xml
: Pre-trained Haar cascade XML file for mouth detection.Icon.png
: Icon image used for the application window.
- If the webcam is not accessible, ensure it is connected and not being used by other applications.
- Check for any warnings or errors displayed in the terminal while running the script.
Contributions to improve the functionality or add new features are welcome! Please fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
This project was developed as part of an academic assignment. Unit: ICS2207
at the University of Malta
.
For any inquiries or feedback, please contact Andrea Filiberto Lucas.