Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- import numpy as np
- parts = 5
- phase = 0 # 0 ~ parts*2 = 0
- w, h = 500, 100
- while True:
- img = np.zeros((h, w, 3), dtype='uint8')
- if phase >= parts:
- per = parts - (phase - parts)
- else:
- per = phase
- coord = int(per / parts * w)
- img = cv2.rectangle(img, (coord, 0), (0, h-1), (255, 255, 255), -1)
- cv2.imshow('win', img)
- cv2.waitKey(1)
- phase += 1
- phase %= parts*2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement