import threading, time
import cv2
import queue
input_buffer = queue.Queue()
def processing():
while True:
print("get")
frame=input_buffer.get()
cv2.imshow("Video",frame)
time.sleep(0.025)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
return
cap = cv2.VideoCapture('cats.mp4')
t = threading.Thread(target=processing)
t.start()
while True:
ret, frame = cap.read()
input_buffer.put(frame)
time.sleep(0.025)
print("put")
No comments:
Post a Comment