<filename>split.py<gh_stars>0
import cv2
import numpy as np
import os

# Playing video from file:
cap = cv2.VideoCapture('IMG_4315.MOV')
try:

    if not os.path.exists('data'):

        os.makedirs('data')

except OSError:

    print ('Error: Creating directory of data')
currentFrame = 0
while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()
    # Saves image of the current frame in jpg file
    name = './data/umber' + str(currentFrame) + '.jpg'
    print ('Creating...' + name)
    cv2.imwrite(name, frame)
    # To stop duplicate images
    currentFrame += 1
    if not ret: break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

<filename>split.py<gh_stars>0
import cv2
import numpy as np
import os

# Playing video from file:
cap = cv2.VideoCapture('IMG_4315.MOV')
try:

    if not os.path.exists('data'):

        os.makedirs('data')

except OSError:

    print ('Error: Creating directory of data')
currentFrame = 0
while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()
    # Saves image of the current frame in jpg file
    name = './data/umber' + str(currentFrame) + '.jpg'
    print ('Creating...' + name)
    cv2.imwrite(name, frame)
    # To stop duplicate images
    currentFrame += 1
    if not ret: break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

# Playing video from file: # Capture frame-by-frame # Saves image of the current frame in jpg file # To stop duplicate images # When everything done, release the capture