C++ opencv 读取mp4文件

来源:互联网 发布:vb计算圆的面积和周长 编辑:程序博客网 时间:2024/06/06 18:42

1.第一步:安装Xvid

2.第二步:安装ffdshow

3.看代码

#include "./opencv2.4.10/core.hpp"#include "./opencv2.4.10/highgui.hpp"#include "./opencv2.4.10/imgproc_c.h"#include "./opencv2.4.10/mat.hpp"using namespace std;using namespace cv;int main(){IplImage *frame = NULL;CvCapture *capture = NULL;capture = cvCreateFileCapture("test.mp4");frame = cvQueryFrame(capture);cvNamedWindow("frame");while (frame){cvShowImage("frame", frame);cvWaitKey(20);cout << "Frame Grabbed." << endl;frame = cvQueryFrame(capture);}return 0;}


第四步:将把opencv_ffmepg2410.dll放在根目录下就可以读取.

一切ok了。

0 0
原创粉丝点击