Advertisement
dan-masek

Untitled

Apr 20th, 2018
929
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. import cv2
  2. import numpy as np
  3.  
  4. file_name = "f:\\MOV_20170813_0318580.mp4"
  5. window_name = "window"
  6. interframe_wait_ms = 30
  7.  
  8. cap = cv2.VideoCapture(file_name)
  9. if not cap.isOpened():
  10.     print "Error: Could not open video."
  11.     exit()
  12.  
  13. cv2.namedWindow(window_name, cv2.WND_PROP_FULLSCREEN)
  14. cv2.setWindowProperty(window_name, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
  15.  
  16. while (True):
  17.     ret, frame = cap.read()
  18.     if not ret:
  19.         print "Reached end of video, exiting."
  20.         break
  21.  
  22.     cv2.imshow(window_name, frame)
  23.     if cv2.waitKey(interframe_wait_ms) & 0x7F == ord('q'):
  24.         print "Exit requested."
  25.         break
  26.  
  27. cap.release()
  28. cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement