#include <stdio.h>
#include <string>
#include <iostream>
#include <io.h>
#include <fstream>
#include <vector>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
VideoCapture capture("C:\\Users\\admin\\Desktop\\1.mp4");
int i = 0;
//std::string image_name;
char image_name[20];
while (1)
{
Mat frame;
capture >> frame;
imshow("dqsp", frame);
//转换格式
sprintf_s(image_name, "%s%d%s", "image", i, ".jpg");
std::string str(image_name);
cv::imwrite("C:\\Users\\admin\\Desktop\\newimages\\" +str, frame);
waitKey(30);
i++;
}
return 0;
}
opencv截取视频帧并保存为图片。
猜你喜欢
转载自blog.csdn.net/weixin_39608351/article/details/82593816
今日推荐
周排行