import cv2
capture = cv2.VideoCapture(0)
i=0
while True:
    ret, new_frame = capture.read()
        if ret:
            cv2.imwrite('frame_%d.jpg' % i, new_frame)
            i += 1