#include <opencv2\opencv.hpp>
using namespace cv;
int main()
{
VideoCapture cap(1); //打开摄像头
Mat frame;
int i = 1;
while (1)
{
String filename = format("photo%d.jpg", i);
char key = waitKey(100);
cap >> frame;
imshow("frame", frame);
switch (key)
{
case'p':
i++;
imwrite(filename, frame);
imshow("photo", frame);
waitKey(500);
destroyWindow("photo");
break;
default:
break;
}
}
}
opencv拍照保存代码
猜你喜欢
转载自blog.csdn.net/qinshiyang/article/details/82289812
今日推荐
周排行