用OpenCV显示视频时遇到问题

刚刚接触OpenCV,运行了书上的例程,程序编译没有问题,在视频显示快要结束时遇到了下面的问题,代码在后面

#include "stdafx.h"
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\video\tracking.hpp>
using namespace cv;
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
//读入视频
VideoCapture capture("111.avi");

//循环显示每一帧
while(1)
{
Mat frame;//定义一个Mat变量,用于存储每一帧的图像
capture>>frame;//读取当前帧
imshow("读取视频",frame);//显示当前帧
waitKey(10);//延时30ms
}
return 0;
}

posted @ 2016-07-23 22:54  xzabg  阅读(563)  评论(0编辑  收藏  举报