Regarding imshow (OpenCV with OpenGL support) (Bug #3352)
Description
The following code is giving flickering window without displaying any image.
Mat img = imread("image.jpg",CV_LOAD_IMAGE_ANYCOLOR); namedWindow("window", WINDOW_OPENGL); imshow("window",img); waitKey(0);
and following code is working fine.
Mat img = imread("image.jpg",CV_LOAD_IMAGE_ANYCOLOR); namedWindow("window", WINDOW_AUTOSIZE); imshow("window",img); waitKey(0);
Further, imshow() has the mentioned faulty behaviour if namedWindow() is not called explicitly and OpenCV has been compiled with OpenGL support.
I already found that adding a call to waitKey() before imshow() solves the problem, probably because it handles messages that need to be handled in between the creation of the window and the displaying of an image. So, this works:
Mat img = imread("image.jpg",CV_LOAD_IMAGE_ANYCOLOR); namedWindow("window", WINDOW_OPENGL); waitKey(0); imshow("window",img); waitKey(0);
However, this solution is neither documented nor consistent with OpenCV versions compiled without OpenGL support.
I am using Windows 7 64 bit, OpenCV 2.4.6.0 built with default settings + OpenGL-support. The same behaviour has been reported for OpenCV 2.4.3 with Windows 7 32 bit:
http://answers.opencv.org/question/7916/regarding-imshow-opencv-compiled-with-opengl/
Associated revisions
Merge pull request #3352 from alucarded:BackgroundSubtractorMOG2_optimization
History
Updated by Dmitry Retinskiy over 11 years ago
Hi Philipp,
could you try to compile and run .../samples/gpu/opengl.cpp and reply if you observe the same behavior?
Updated by Dinar Ahmatnurov over 11 years ago
Hi Philipp,
Any updates?
- Status changed from New to Open
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4644