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(); | ||||
} | |||||
} |