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;
}