mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Added camera open check
This commit is contained in:
@@ -229,6 +229,12 @@ int main(int argc, char **argv)
|
||||
cap.open(findFile(parser.get<String>("input")));
|
||||
else
|
||||
cap.open(parser.get<int>("device"));
|
||||
|
||||
if (!cap.isOpened()) {
|
||||
cerr << "Error: Video could not be opened." << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
//! [Open a video file or an image file or a camera stream]
|
||||
// Process frames.
|
||||
Mat frame, blob;
|
||||
|
||||
Reference in New Issue
Block a user