1 | initial version |
Try to read frame, if you can't it probably means that the camera was disconnected.
VideoCapture cap;
Mat frame;
cap.open(0);
if( !_cap.read(frame))
{
cout << "failed to read frame";
return;
}
There's also a cap.IsOpened() method that returns 1 or 0, weather the camera is connected or not
2 | No.2 Revision |
Try to read frame, if you can't it probably means that the camera was disconnected.
VideoCapture cap;
Mat frame;
cap.open(0);
if( !_cap.read(frame))
if(!cap.read(frame))
{
cout << "failed to read frame";
return;
}
There's also a cap.IsOpened() method that returns 1 or 0, weather the camera is connected or not
3 | No.3 Revision |
Try to read frame, if you can't it probably means that the camera was disconnected.
VideoCapture cap;
Mat frame;
cap.open(0);
if(!cap.read(frame))
{
cout << "failed to read frame";
return;
}
There's also a cap.IsOpened() method that returns 1 or 0, weather if the camera VideoCapture object is connected opened or notnot.