您的位置:首页 > 编程语言 > C语言/C++

C++ opencv 读取mp4文件

2016-05-21 16:43 1286 查看
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了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: