#include #include #include #include #include using namespace cv; using namespace std; int main(int argv, char** argc) { Mat frame; VideoCapture cap(0); if (!cap.isOpened()){ cerr << "ERROR! Unable to open camera\n"; return -1; } cout << "Start grabbing" << endl << "Press any key to terminate" << endl; for (;;) { cap.read(frame); if (frame.empty()){ cerr << "ERROR! Blank frame grabbed \n"; break; } imshow("Live", frame); if (waitKey (5) >= 0) break; } return 0; }