Proper error message, Check if grab() was successfull
This commit is contained in:
parent
551d5f4bb3
commit
e45f46c102
@ -39,17 +39,19 @@ Mat Input::readWebcam()
|
||||
Mat image;
|
||||
|
||||
if(!cap.isOpened()) {
|
||||
cout << "Fehler";
|
||||
cout << "Video capture not opened" << std::endl;
|
||||
return Mat();
|
||||
}
|
||||
|
||||
cap.grab();
|
||||
if(!cap.grab()) {
|
||||
cout << "Could not grab frame from camera" << std::endl;
|
||||
return Mat();
|
||||
}
|
||||
cap.retrieve(image);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
void Input::freeWebcam()
|
||||
{
|
||||
this->cap.release();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user