berak, I must apologize in that, like so many of my own users, I did not appreciate every word of your answer. You said “all the gui code (imshow(), waitkey()) has to stay on the main thread” It took me awhile to realize that the key word is “main”. I was beating my head against a wall putting all of the gui code mentioned into the secondary camera streaming thread and wondering why I was still having problems. When I finally realized that it is the “main” thread in which all of the code had to be I wrote a function called CheckCameraWindowStuff() that is called by the main thread to check for memory variables periodically. So, among others, it would check for the memvar bImShowCameraImage with
if (bImShowCameraImage == true) {
cv::imshow(“cameraWindow”, mCameraImage);
cv::waitKey(10);
bImShowCameraImage = false;
}
In the camera stream thread where it used to have the imshow it now just sets the memvar to be read by the main thread. This goes for all of the other gui functions dealing with this thread including setMouseCallback and destroyWindow. A separate function was made for cv::namedWindow to create the window when the time comes.
Now, with literally everything dealing with this camera stream, in the MAIN thread, everything is working fine in OCV 4.5
One other thing I had to do. The main thread called a Modal Dialog in which the user selected the camera and then started the camera which started the camera stream thread etc. From that dialog the user was also able to select the video and run that by programmatically clicking on the main threads “Select Video” menu item. Using OCV 2.4 and 3.4 that worked but with 4.5 the camera stream thread stopped. It took awhile to realize that, like the gui items mentioned above that “Select Video” menu item had to be clicked from within the main thread and the dialog button function to select a video had to return back to the modal dialog. Again I set a memvar to be read by the main thread and that solved the problem. Baby Steps… Thanks again for your help. Sorry I didn’t pay attention to every word the first time.