4,447
社区成员
发帖
与我相关
我的任务
分享
void initWebcam(VideoCapture &videoCapture, int cameraNumber)
{
// Get access to the default camera.
try { // Surround the OpenCV call by a try/catch block so we can give a useful error message!
videoCapture.open(cameraNumber);
} catch (cv::Exception &e) {}
if ( !videoCapture.isOpened() ) {
cerr << "ERROR: Could not access the camera!" << endl;
exit(1);
}
cout << "Loaded camera " << cameraNumber << "." << endl;
}