#include <stdlib.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/core/vpImageConvert.h>
int main(int argc, char** argv)
{
int device = 0;
if (argc > 1)
device = atoi(argv[1]);
std::cout << "Use device: " << device << std::endl;
#if (VISP_HAVE_OPENCV_VERSION >= 0x020100)
try {
cv::VideoCapture cap(device);
if(!cap.isOpened()) {
std::cout << "Failed to open the camera" << std::endl;
return -1;
}
cv::Mat frame;
cap >> frame;
std::cout << "Image size: " << frame.rows << " " << frame.cols << std::endl;
for(;;) {
cap >> frame;
break;
}
}
std::cout << "Catch an exception: " << e << std::endl;
}
#endif
}