#include<iostream>
#include "stdio.h"
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
int ss = 80;
char filename[200];
VideoCapture camera = VideoCapture("things1.mp4");
while (1){
Mat image;
camera >> image;
cout << image.cols << " " << image.rows << endl;
Mat img = image.clone();
if (image.empty())
break;
resize(image, img, Size(640, 360));
if (waitKey(50)== 32)
{
sprintf(filename, "%s%d%s", "images\\", ss++, ".jpg");
imwrite(filename, img);
}
imshow("image", img);
}
return 0;
}
opencv按空格保存图片
最新推荐文章于 2023-01-24 09:47:27 发布