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 email@example.com. 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.
- Opencv Python program for Face Detection
- Face Detection using Python and OpenCV with webcam
- 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
- Real-Time Edge Detection using OpenCV in Python | Canny edge detection method
- Image Processing in Java | Set 9 ( Face Detection )
- Python | Corner Detection with Shi-Tomasi Corner Detection Method using OpenCV
- Python | Corner detection with Harris Corner Detection method using OpenCV
- Python | Smile detection using OpenCV
- Line detection in python with OpenCV | Houghline method
- Detection of a specific color(blue here) using OpenCV with Python
- OpenCV C++ Program to blur an image
- OpenCV C++ Program to play a video
- OpenCV C++ Program to blur a Video