I am looking for a simple way for to do real-time face detection and capture using open-cv and Picamera in Python. I figured out how to recognize the face from and image file, but I dont' know the rest. I am trying to have a real-time stream of video, and when a face is detected in that video, the camera takes a picture of the face. Is this possible using open-cv and Python? NOTE: there is a difference between face recognition and face detection. I am asking for help on how to detect the face and take a picture of it, not the recognition part. Thanks for any help!
Asked
Active
Viewed 125 times
1 Answers
2
my two cents are, if you have the original frame from the live video stream, and you can detect which frame has a face. Then can you just save that frame as a png or jpeg image file, no need to take any further image again? I know there can be situations where we need to take a new image, but just one solution I thought of is this.

mani9418
- 141
- 1
- 1
- 9
-
OK, that sounds good, but how do I trigger the fame capture when it detects a face? – Alen Apr 04 '21 at 21:47
-
I have not seen your code yet, but what i can generally tell, is that we use something like `ret, frame = capture.read()` in opencv to read frames from the live stream, and in later part of the code, when you are doing your processing and deduces a face in a frame, you can just save that frame like a simple image file using `cv2.imwrite("frame_name.jpg" , frame) `. I hope this helps. – mani9418 Apr 04 '21 at 21:55
-
Thank you, I will look at that – Alen Apr 04 '21 at 22:00
-
Glad to help, if this answer solved your problem please mark it as accepted by clicking the check mark next to the answer – mani9418 Apr 04 '21 at 22:06