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了。
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了。
相关文章推荐
- C++基类的析构函数为什么是虚函数
- C++倒计时程序,可根据需求自行修改。
- C++作业6
- C语言文件操作一
- c++ for_each
- STL Iterator 迭代器
- C++实现设计模式之--单例模式
- C++图像处理中从硬盘读入图像文件,并将相应数据赋值给图像类的char**data成员
- c++实现矩阵的余弦相似度
- opencl的c++程序
- C++ socket函数解析
- C++ 虚函数表解析
- C++迷宫问题(BFS)
- CppUnit的安装及使用指南
- 在使用cppunit,搭建测试环境时遇到的问题以及解决办法(仅供参考)
- C语言基础及例程
- C语言到底怎么分配空间
- 多线程之信号量(By C++)
- 第十三周项目 1分数类中的运算符重载
- C++实现稀疏矩阵的压缩存储、转置、快速转置