Now there's a need to collect faces, and there's only one person in each picture. My solution is to use a collection to record a video and upload it to the PC. Use OpenCV on your PC to save each frame in the picture as a JPG image.
Here's the code:
Import time
Import Cv2
if __name__ = = ' __main__ ':
# Fill in the absolute path of the video
VidCap = Cv2. Videocapture ('/home/shushi/video/hunting ground. mp4 ')
success, image = Vidcap.read ()
start_time = Time.time ()
Print (start_time)
While success:
end_time = Time.time ()
file_name = str (end_time). Replace ('. ', ')
# screenshot Every three seconds
if 3 = = Int ( End_time-start_time):
start_time = end_time
# Save Absolute path to JGP
cv2.imwrite ('/home/shushi/video/' + file_name + ". jpg", image) # Save Frame as JPEG file
success, image = Vidcap.read ()
if Cv2.waitkey (10) = = 2 7: # Exit if Escape is hits
break
Put the video in the same directory as the Python file, and then run the program, and you'll get a JPG image of the video frame: