I’ve written some code, which currently consists of two windows to show different stages of some processing algorithm. Quite simply, I’ve created the two windows with cv::namedWindow(), and I’m displaying the cv::Mat with cv::imshow(). I’m having an issue where every now and again, randomly (but not always), cv::imshow() refuses to update the two windows. The program hasn’t hung, and I can see that it is still working and processing the incoming frames (as I’m printing stuff into the terminal to show this), it’s just that the windows aren’t showing the new frames. I’ve included cv::waitKey(2) after each call to cv::imshow(), however this doesn’t help.
This is very annoying, and I can’t seem to find anything online. This doesn’t always happen, but it does more often than not. Sometimes it takes a few minutes, sometimes it takes a few seconds.
I’m using Ubuntu 12.04 (and Ubuntu 11.10 – this happens on both of my machines with two different cameras) with OpenCV 2.3.1.
One way I’ve been able to get around that issue is by using
cv::destroyWindow()
after calling a window. This works well if you’re just showing a sequence of images, but not so well if you’re showing video.