This Python script allows you to real-time face detection through a webcam or video. It use the OpenCV library and a pre-trained Haarcascades face detector.
- Webcam
- Python 2.x (Not recommand)
- OpenCV library (
cv2
)
- 2Ghz+ CPU
- Python 3.x
This script request OpenCV library, You can install the librarie using:
pip install opencv-python
- Clone the repository or download the script.
- Connect your webcam to your computer
- Run the script using your IDE or the following command:
python main.py
You can also use a video file instead of using the webcam by modifying the cap = cv2.VideoCapture(0) line in the script.
and replace it with your video path
- press
q
while the OpenCV window is in focus.
This script is using the OpenCV library and pre-trained Haarcascades for face detector.
Feel free to use this project for anything =)