写opencv的时候,遇到了使用imshow显示灰色窗口的麻烦,图像读取完全正常,但是窗口显示的只有灰色,好像哪里出错了感觉。跟踪了一下,发现确实是读入了帧,只是在显示的时候没有出来。
在网上查了下文档,原来是循环中,highgui没有给予imshow绘制处理的时间。需要在imshow添加waitKey(30)
在网上查了下文档,原来是循环中,highgui没有给予imshow绘制处理的时间。需要在imshow添加waitKey(30)
引用
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(30),则会出现灰屏现象。这是因为highgui无法处理imshow的绘制请求。

4557

被折叠的 条评论
为什么被折叠?



