I'm trying to extract distinct frames from videos. I used opencv(code below) which lets me extract all the frames from a video but what I'm looking for are unique images which don't overlap each other. Any suggestions? TIA.
import cv2
import os
video = cv2.VideoCapture("INPUT.MOV")
currFrame =0
while(True):
ret,frame = video.read()
if ret:
name = './data/frame'+ str(currFrame) + '.jpg'
cv2.imwrite(name, frame)
currFrame += 1
else:
break
video.release()
cv2.destroyAllWindows()
EDIT: it's a continuous video. For example, https://www.youtube.com/watch?v=JBLQbOG8Z1Y , in this, I need the separate shots of the skyline i.e, one at the 1st second and one at 6th second.