This Python script captures video from your webcam and detects faces in real-time using the OpenCV library and the dlib face detection model.
To get started, you'll need to have Python and the following libraries installed:
- OpenCV
- dlib
You can install these libraries using pip:
pip install opencv-python pip install dlib
- Clone this repository or download the script to your local machine.
- Ensure that your webcam is connected and accessible.
- Open a terminal or command prompt and navigate to the directory containing the script.
- Run the script using the following command:
python face_detection.py
The script will open your webcam and start detecting faces in real-time. Detected faces will be highlighted with rectangles, and a number will be displayed on each detected face to indicate its order.
To exit the application, simply press the 'q' key on your keyboard while the window displaying the webcam feed is in focus.
OpenCV dlib