opencv调用摄像头截图保存图片
int process(VideoCapture& capture)
{int n = 0;
char filename[200];
string window_name = "video | q or esc to quit";
cout << " \n\t按下【Space】空格键可以截图,图片将存放在工程目录下。\n\n\t【Esc】和【q】键 - 退出程序。 " << endl;
namedWindow(window_name, CV_WINDOW_KEEPRATIO); //resizable window;
Mat frame;
for (;;)
{
capture >> frame;
if (frame.empty())
break;
cv::Mat gray;
cv::cvtColor(frame,gray,COLOR_RGB2GRAY);//转换为灰度图
//vector<string> codes;
vector<DataMatrixCode> codes;
Mat corners;
findDataMatrix(gray, codes);
drawDataMatrixCod