Proper error message, Check if grab() was successfull

This commit is contained in:
2022-11-30 18:55:20 +01:00
parent 551d5f4bb3
commit e45f46c102
+6 -4
View File
@@ -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();
}
}