关于opencv播放视频的笔记

来源:互联网 发布:阁瑞钛伦特软件靠谱吗 编辑:程序博客网 时间:2024/06/05 17:41
#include  "highgui.h"
#include  "iostream"

using namespace std;
using namespace cv;


int  main()
{
VideoCapture video1("Seq04.avi");                                   //当后面的文件名为0时为打开摄像头
if(!video1.isOpened())                                                        //  isOpened检测状态
double zhenlv=video1.get(CV_CAP_PROP_FPS);     //get得到参数

double delay=1/zhenlv;                                                     //帧率=1秒播放的图片数


Mat frame;
while(1)
{

if(!video1.read(frame))                                             //read后面跟的是Mat型
break;                                                                    //(没有break会出错)
imshow("abc",frame);
waitKey(1000*delay);                                               //延迟N毫秒,所以要乘以1000
}
}
0 0
原创粉丝点击