OpenCV显示视频帧时出现一个问题,就是imshow之后若是不加waitkey则无法显示,找了很久也没找到原因。
cvWaitKey(x) / cv::waitKey(x)
does two things:
-1
.cv::namedWindow()
, or showing images
with cv::imshow()
.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()
.
所以imshow之后还是加上waitkey语句吧,为节约时间就设置为最小值1好了。
cv::waitkey(1);
OpenCV: imshow后不加waitkey无法显示视频,布布扣,bubuko.com
OpenCV: imshow后不加waitkey无法显示视频
原文:http://www.cnblogs.com/kissfu/p/3608016.html