OpenCV imshow()之后没有waitKey()无法显示图像

今天突然遇到了这么个奇怪的问题,之前一直没有注意到。

imshow()之后要加waitKey()才能正确显示图像。

官方说明如下:

A common mistake for opencv newcomers is to call cv::imshow() in a loop through video frames, without following up each draw with cv::waitKey(30). In this case, nothing appears on screen, because highgui is never given time to process the draw requests from cv::imshow(). 

参考

OpenCV imshow()之后没有waitKey()无法显示图像

你可能感兴趣的:(OpenCV,计算机视觉)