Guest User

Untitled

a guest
Sep 8th, 2022
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | Source Code | 0 0
  1. import cv2 as cv
  2. import random
  3.  
  4. cap = cv.VideoCapture('file_name.avi')
  5.  
  6. random_frame = random.randint(1,99999)
  7.  
  8. cap.set(cv.CAP_PROP_POS_FRAMES,random_frame)
  9.  
  10. ret, frame = cap.read()
  11.  
  12. cv.imshow("random_frame",frame)
  13.  
  14. while cap.isOpened():
  15.     if cv.waitKey(1) == ord('q'):
  16.         break
  17.    
  18. cap.release()
  19. cv.destroyAllWindows()
Add Comment
Please, Sign In to add comment