if (!capture.isOpened()) { printf("could not open camera...\n"); return-1; } cv::namedWindow("capture", WINDOW_AUTOSIZE);
cv::Mat frame; int index = 0;
while (true) { if (!capture.read(frame)) break; cv::imshow("capture", frame); char c = waitKey(1); if (c >= 49) { index = c - 49; } if (c == 27) { break; } }