#include <opencv2/opencv.hpp>
#define IMG_WIDTH 720
#define IMG_HEIGHT 576
using namespace cv;
int main()
{
Mat SrcImg;
Mat Output(IMG_WIDTH, IMG_HEIGHT, CV_8UC3, Scalar(0, 0, 0));
VideoWriter videoWriter;
videoWriter.open("gray.avi", CV_FOURCC('M', 'J', 'P', 'G'), 10, Size(IMG_WIDTH, IMG_HEIGHT));
char filename[200];
for (int ImgCount = 1; ImgCount < 1000; ImgCount++)
{
sprintf(filename, "F:\\data\\ir\\TEST_FRAME\\fire_frame\\%d.bmp", ImgCount);
SrcImg = imread(filename);
if (SrcImg.data==0)
{
return false;
}
else{}
videoWriter.write(SrcImg);
imshow("Output", SrcImg);
waitKey(1);
}
return true;
}
图片保存成视频
最新推荐文章于 2020-11-05 14:03:43 发布