Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Threads in PyQt and opencv



  • i have a code in python ,
    and it has 5 buttons ,
    and when each button clicks i want to access the webcam ,
    and get frames from it and do some things on the webcam frames(each button performs diffrient things on the webcam frame)

    the problem is that when first button gets the webcam on a separate THREAD
    when i click other buttons , they can't access the Webcam ,
    how can i notify the that thread to releases the Webcam for others
    ?


  • Lifetime Qt Champion

    Hi
    you could send a signal to the tread via the normal signal & slots?
    Or is the thread not a Qt thread but a openCV one?



  • @iammhz said in Threads in PyQt and opencv:

    when i click other buttons , they can't access the Webcam

    What if you just have only one method/thread to access the webcam, independent on which button is actually pressed, and when the image is captured then pass that image to the specific processing method/thread depending on the button/effect pressed.

    This way you'll avoid the bottleneck of "sharing" the webcam among threads


Log in to reply