#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui.hpp>
using namespace std;
using namespace cv;
int main(int argc, char ** argv)
{
char filename[1024] = "D:/learn/伟哥/伟哥/aa.avi";
//Mat myMat(img.size(), img.type(), Scalar(0, 0, 0)); // 构造函数
VideoCapture capture;
capture.open(filename);
if (!capture.isOpened())
{
cout << "Could not initialize capturing...\n" << endl;
return -1;
}
Mat frame;
int n = 1;
while (true)
{
capture >> frame;
char* cstr = new char[120];
sprintf(cstr, "%s%d%s", "./shipin_capture/", n++, ".jpg");
imwrite(cstr, frame);
imshow("Video_Capture", frame);
waitKey(50);
}
return 0;
}
Opencv读取视频保存图片
最新推荐文章于 2022-03-30 16:36:05 发布