Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://youtu.be/XJnKIaGFvgc
- import cv2
- import numpy as np
- from glob import glob
- from time import time
- files = glob('imgs/*') # running dog frames from https://youtu.be/Pqk86Oz6IXQ
- offset = 167
- start = 9 - 1
- end = 19 - 1
- imgs = []
- for file in files:
- img = cv2.imread(file)
- img = cv2.resize(img, None, fx=0.5, fy=0.5)
- imgs.append(img)
- bpm = 175
- start_time = time()
- mul = 1
- while True:
- cur_time = time() - start_time
- cur_pos = (cur_time % (60 / bpm)) / (60 / bpm)
- cur_img = int(cur_pos * (end - start + 1)) + start
- cv2.imshow('win', imgs[cur_img])
- key = cv2.waitKey(1)
- if key == ord('s'):
- start_time = time()
- elif key == ord('x'):
- exit()
Add Comment
Please, Sign In to add comment