0

I am working on a project for which I need run 3 threads in python. 1 for getting frames and the other 2 for proccessing them. I don't know how to pass variables between threads (I want to pass frames to the other threads). Please help me out by providing a sample code.

Thanks a lot!

1 Answer 1

0

You need a mechanism for handling the case where the image capture thread is producing more images than the display thread can handle, or conversely the case where the display thread has to wait for the next image to be captured.

The easiest way to handle these cases is to use a message queue; images are added to the front of the queue with a check to ensure that there aren't too many, then they are removed from the back of the queue for display.

Here is a simple example using PyQt and OpenCV, and a more complex example that does optical position measurement

1
  • Thanks, it is a bit hard example but i found another solution. Thanks again for your effort to answer. Jul 23, 2023 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.