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

Mat image; Mat image;


if(!cap.isOpened()) { if(!cap.isOpened()) {
cout << "Fehler";
cout << "Video capture not opened" << std::endl;
return Mat(); return Mat();
} }


cap.grab();
if(!cap.grab()) {
cout << "Could not grab frame from camera" << std::endl;
return Mat();
}
cap.retrieve(image); cap.retrieve(image);
return image; return image;
} }


void Input::freeWebcam() void Input::freeWebcam()
{ {
this->cap.release(); this->cap.release();
}
}

Loading…
Cancel
Save