Answer the question
In order to leave comments, you need to log in
How to deal with multithreading in OpenCV?
Hello everyone, I've been sitting for three hours now and I can't understand. I need to capture from the camera in one thread, and output to the screen in the other thread. Anyone have any suggestions how to do this?
It is clear that there will be two functions:
...
camera = cv2.VideoCapture(0, cv2.CAP_DSHOW)
def read():
while True:
result, frame = camera.read()
def show():
while True:
cv2.imshow("test", frame)
t1 = threading.Thread(target=read)
t2 = threading.Thread(target=show)
t1.start()
t2.start()
t1.join()
t2.join()
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question