multithreading in c++, capturing thread stops after some loops
- opencv 3.4.2
- OS ubuntu 16.04
g++ 7.4.0
I am trying capture and process image on different threads.
In Mcapture(), the image is captured; and after that if the processing threads completed processing, then the captured image is divided into 2 parts and moved to global variables, else it goes on capturing.
In the other 2 threads , firstly the loop for saving the frame into global variables is paused, and after that a dummy processing is done, and after that , 2 half processed image is combined to a global UMat, to get the full image.
The code is running indefinitely, but after some 9-10 iterations , In Mcapture() it is going through the capture loop but it is failing to enter the loop (which divides the image and moves it to a global variable). And also the output of the combined processed images are not in sync with each other
Here is the link for my source_code, op_log, and the op_image. It will be very helpful, to get some help, I am getting no clue why that loop is stopping in between.
please put (the relevant part of) your code into the question, not on an external dropbox, thank you.