Advertisement
dan-masek

Untitled

Sep 18th, 2018
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. cap = cv2.VideoCapture(path_to_video)
  2. if not cap.isOpened():
  3.     print "Failed to open video."
  4.     exit(1)
  5.  
  6. prev_frame = None
  7. while(True):
  8.     state, frame = cap.read()
  9.     if not state:
  10.         break # Reached end of video
  11.  
  12.     frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  13.     if prev_frame is not None:  
  14.         matches_gms = match(prev_frame, frame)
  15.     prev_frame = frame
  16.  
  17. cap.release()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement