OpenCv学习笔记(五):使用VideoCapture类函数实现视频的播放

来源:互联网 发布:淘宝原创设计男装店铺 编辑:程序博客网 时间:2024/05/22 06:47

     opencv早就实现了对视频的处理,需要指出的是opencv对视频的处理比matlab实现视频处理不知要快了多少倍。为了交流学习,我都把代码写的特别短,就不做详细解释了。需要说明的是VideoCapture函数:

 

#include "stdafx.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <vector>
using namespace cv;
int main( int argc, char** argv )
{
   Mat frame;
   cvNamedWindow("myVideoPlayer");
   VideoCapture cp("d:/Bucket_list.avi");
   while(1)
   {
    cp>>frame;
    imshow("myVideoPlayer",frame);
    waitKey(30);
   }
   waitKey(0);
   return 0;
}