I've been trying to debug this for a while but I'm at wit's end so I'll try to ask this here. I guess I'm just asking for hints on what could cause this.
I have two programs: A C++ back-end that does a lot of computer vision stuff, and a Python front-end that shows a GUI. The GUI is the entry point and starts up the back-end after loading. Currently, the back-end somehow blocks its main thread here:
if(image.size() != getImageSize()) {
cv::imshow("projectorDisplay",display_image(cv::Rect(0,0,getImageSize().width,getImageSize().height)));
} else {
cv::imshow("projectorDisplay",display_image); //Thread blocks at this line.
}
cv::waitKey(10);
It's meant to display display_image on a projector that's connected to the computer. The image doesn't get displayed, and the thread blocks so the back-end doesn't get any further. The window is created in the constructor of the same class as follows:
cv::namedWindow("projectorDisplay",CV_WINDOW_NORMAL);
cv::moveWindow("projectorDisplay",2000,0); //Move the window to the projector screen. TODO: Hard-coded value.
cv::setWindowProperty("projectorDisplay",CV_WND_PROP_FULLSCREEN,CV_WINDOW_FULLSCREEN); //Make fullscreen.
cv::waitKey(50);
But here's the strange part that led me to think this is a very difficult bug: When I run the back-end without the GUI, it works fine. The GUI is a fairly simple Qt-based application in Python that communicates commands via local sockets to the back-end. It should be completely separate; it's even written in a script-language, and runs also when the back-end is not present (the back-end is a plug-in).
Some other things I noticed while debugging:
cv::imshow("projectorDisplay",cv::imread("testimage.png")); to the constructor, it is displayed properly.cv::imshow("projectorDisplay",cv::imread("testimage.png")); instead of the line where it otherwise gets blocked, it blocks at the new imshow too, so it's not just an issue of a corrupt image.cv::imshow("projectorDisplay2",display_image), a new window is created and the image is displayed correctly.CV_WINDOW_NORMAL flag to CV_WINDOW_OPENGL in the constructor, the back-end crashes immediately at launch.Does anyone have an idea of what could cause such a thing and where I should look to fix it?
The answer is disturbingly simple; recompiling opencv without QT fixes the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With