Real-time face detection
In this project, I've to use OpenCV and Viola-Jones Algorithm to build a face detection system that works in real-time.
In this project, I've to use OpenCV and Viola-Jones Algorithm to build a simple face detection system that works in real-time.
I need to detect faces on images and from a webcam in real-time.
Build an algorithm or machine learning model to detect faces on images.
I've used Python, OpenCV, and the Viola-Jones Algorithm to build a solution to detect faces fast.
The solution has good accuracy and can detect faces really fast.
How to use it
To detect the face the software uses the Haar-like features with the help of the haarcascade_eye.xml and haarcascade_frontalface_default.xml files.
To run this code, download Python 3 from Python.org.
After installing Python, add the required package using pip installer:
pip install -r requirements.txt
Then, clone the GitHub repository:
git clone https://github.com/cpatrickalves/cv-realtime-face-detection
To run the detection in real-time using the webcam, run:
To perform the face detection on an image, just add the file name as an argument:
python face_recognition.py -f image.jpg
The script will create an output with a similar name. It with add the _output in the file name (ex: image_output.jpg)
-s flag to perform smile detection.
You can also run this script as an Streamlit application:
streamlit run app.py
It will automatically open the browser and show the app.
- Python - Programming Language.
- OpenCV - Open Computer Vision Library.
- Streamlit - Open-source app framework for Machine Learning and Data Science teams.
The source code is available at Github.