Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

yes it will work for updated versions also and you can try like this also. import cv2 import numpy as np

cap = cv2.VideoCapture("challenge.mp4") # if you are giving camera as input then give (0) to videoCapture. while(cap.isOpened()):

    # Take each frame
ret, image = cap.read()

if ret:
          # do operations on image as per your application
   else:
    cap.set(cv2.CAP_PROP_POS_FRAMES,0)
cv2.imshow('img',image)

if cv2.waitKey(25) & 0xFF == ord('q'):
            break

cap.release() cv2.destroyAllWindows()

this all things you can get directly from opencv tutorial... try @kirill