OpenCV之视频——将视频分割成图像
2017-03-20 10:35
309 查看
将视频分割成一帧帧的图像,并保存在指定位置:
#include <cv.h> #include <highgui.h> #include <iostream> #include <string> using namespace std; using namespace cv; void splitIntoFrames(string file_path) { CvCapture *capture = cvCaptureFromFile(file_path.c_str()); if (!capture) { cerr << "cvCaptureFromVideo failed!!" << endl; } IplImage* frame = NULL; int frame_num = 0; //char* prefix = "F:\Research\Deep Learning\Project\Lip\images\"; while (frame = cvQueryFrame(capture)) { frame_num++; string curr_filename("F:\\Research\\Deep Learning\\Project\\Lip\\images\\frame_"); curr_filename += to_string(frame_num) ; curr_filename += ".jpg"; cvSaveImage(curr_filename.c_str(), frame); cout << "save images." << curr_filename << endl; } } int main() { cout << "split video into frames" << endl; string file_path("F:\\Research\\Deep Learning\\Project\\Lip\\video\\video.mp4"); splitIntoFrames(file_path); }
相关文章推荐
- OpenCV图像分割中的分水岭算法原理与应用详解
- OpenCV学习之图像分割
- 分水岭算法分割图像的原理概述及OpenCV代码实现
- 用opencv简单显示图像和视频(代码有注释)
- opencv之金字塔实现图像分割
- opencv学习笔记(4)----图像分割
- opencv用金字塔cvPyrSegmentation实现图像分割
- Opencv 视频转为图像序列
- opencv将视频序列转换为图像序列保存
- opencv学习笔记7:图像局部与分割
- 小工具--OpenCV从视频中获取图像集
- python opencv入门(读 / 写 显示以及转换图像 和 视频读入)
- OpenCV中文网站上有讲怎么使用OpenCV读入和显示图像和视频
- [opencv入门笔记] 读视频转图像—读取视频中每一帧图像
- Opencv学习——图像及视频读取
- 视频图像分割研究与实现(二):常见图像和视频分割方法概述
- opencv分水岭算法对图像进行分割
- Opencv分水岭算法——watershed自动图像分割用法
- opencv:求视频的前n帧的融合图像
- opencv简单视频与图像操作