Uploaded by eaintsandi123

convertframe

advertisement
import cv2
import os
vid = cv2.VideoCapture('D:\ste/rain.mp4')
currentframe = 0
if not os.path.exists('data'):
os.makedirs('data')
while (True):
success, frame = vid.read()
cv2.imshow("Output", frame)
cv2.imwrite('D:\ste\convertframe/frame' + str(currentframe) + '.jpg', frame)
currentframe += 1
if cv2.waitKey(1) & 0xFF == ord('q'):
break
vid.release()
cv2.destoryAllWindows()
Download