Browse Source

Proper error message, Check if grab() was successfull

pull/1/head
Tim Zeuner 1 year ago
parent
commit
e45f46c102
1 changed files with 6 additions and 4 deletions
  1. 6
    4
      AutonomousMode/Input/input.cpp

+ 6
- 4
AutonomousMode/Input/input.cpp 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();
}
}

Loading…
Cancel
Save