#include<opencv2\opencv.hpp>
#include<iostream>
using namespace std;
using namespace cv;
int main()
{
VideoWriter video("test.avi", CV_FOURCC('X', 'V', 'I', 'D'), 25, Size(720, 576));
String img_path = "C:\\Users\\Administrator\\Desktop\\数据照片\\可见光\\";
vector<String> img;
glob(img_path, img, false);
size_t count = img.size();
for (size_t i = 0; i < count; i++)
{
stringstream str;
str << i << ".jpg";
Mat image = imread(img_path + str.str());
if (!image.empty())
{
resize(image, image, Size(1280, 720));
video << image;
cout << "正在处理第" << i << "帧" << endl;
}
}
cout << "处理完毕!" << endl;
}
OpenCV将图片合并成视频
最新推荐文章于 2024-12-27 16:38:30 发布