This program uses the OpenCV library to detect faces in a live stream from webcam or in a video file stored in the local machine. This program detects faces in real time and tracks it. It uses pre-trained XML classifiers for the same. The classifiers used in this program have facial features trained in them. Different classifiers can be used to detect different objects.
Requirements for running the program:
1) OpenCV must be installed on the local machine.
2) Paths to the classifier XML files must be given before the execution of the program. These XML files can be found in the OpenCV directory “opencv/data/haarcascades”.
3) Use 0 in capture.open(0) to play webcam feed.
4) For detection in a local video provide the path to the video.(capture.open(“path_to_video”)).
Next Article: Opencv Python Program for face detection
This article is contributed by Shashwat Jain. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.
- Opencv Python program for Face Detection
- Face Detection using Python and OpenCV with webcam
- Real-Time Edge Detection using OpenCV in Python | Canny edge detection method
- Python | Corner detection with Harris Corner Detection method using OpenCV
- Python | Corner Detection with Shi-Tomasi Corner Detection Method using OpenCV
- Image Processing in Java | Set 9 ( Face Detection )
- OpenCV C++ Program for coin detection
- OpenCV Python program for Vehicle detection in a Video frame
- Python Program to detect the edges of an image using OpenCV | Sobel edge detection method
- Object Detection with Detection Transformer (DERT) by Facebook
- Detection of a specific color(blue here) using OpenCV with Python
- Line detection in python with OpenCV | Houghline method
- Python | Smile detection using OpenCV
- Circle Detection using OpenCV | Python
- White and black dot detection using OpenCV | Python
- OpenCV | Real Time Road Lane Detection
- Text Detection and Extraction using OpenCV and OCR
- ML | Unsupervised Face Clustering Pipeline
- Deep Face Recognition
- ML | Face Recognition Using Eigenfaces (PCA Algorithm)