//功能:将连续图片合成视频AVI
//日期:2016—05-08
//平台:vs2015+opencv3.1
#include<opencv2\opencv.hpp>
#include<iostream>
#include<Windows.h>
using namespace std;
using namespace cv;
void main()
{
Mat src=imread("C:\\EXPERIMENT\\眼图照片 (glass)\\wph2\\l0.bmp",1);
char image_name[50];
int isColor = 1;
int fps = 10;
int frameWidth = src.cols;
int frameHeight = src.rows;
VideoWriter writer("C:\\EXPERIMENT\\test_l.avi", VideoWriter::fourcc('M', 'J', 'P', 'G'), fps,
Size(frameWidth, frameHeight), isColor);
cout << "info:" << endl
<< "ff.avi" << endl
<< "Size:" << frameWidth << "*" << frameHeight << endl
<< "fps:" << fps << endl;
for (int i = 0; i < 1000; i++)
{
sprintf(image_name, "C:\\EXPERIMENT\\眼图照片(glass)\\wph2\\l%d.bmp", i);
src = imread(image_name, 1);
if (src.empty())
{
MessageBox(NULL, L"全部图像加载完成!", L"温馨提示", MB_OK | MB_ICONINFORMATION);
break;
}
imshow("【src】", src);
waitKey(5);
writer.write(src);
}
}
OpenCV将连续图片合成视频AVI
最新推荐文章于 2024-07-14 15:11:00 发布