#include<opencv2\opencv.hpp>
#include "opencv2/face.hpp"
#include "opencv2/core.hpp"
#include<iostream>
using namespace std;
using namespace cv;
int main()
{
VideoCapture cap(0); //打开默认摄像头
if (!cap.isOpened())
{
return -1;
}
Mat img=Mat::zeros(640,480,CV_8UC3);
for (size_t i = 0; i < 10; cap>>img)
{
if (waitKey(1) == 27)
{
i++;
imwrite("F:\\picture\\test3\\"+to_string(i)+".jpg", img);
}
imshow("test", img);
}
return 0;
}
网友评论