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了。