#include <visp3/core/vpConfig.h>
#ifdef VISP_HAVE_MODULE_SENSOR
#include <visp3/sensor/vpV4l2Grabber.h>
#endif
#include <visp3/blob/vpDot2.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayGTK.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/gui/vpDisplayX.h>
int main(int argc, char **argv)
{
#if ((defined(VISP_HAVE_V4L2) || (VISP_HAVE_OPENCV_VERSION >= 0x020100)) && \
(defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_GTK)))
int device = 0;
if (argc == 2) {
device = std::atoi(argv[1]);
}
std::stringstream ss;
ss << "/dev/video" << device;
std::cout << "Connect to: " << ss.str() << std::endl;
#if defined(VISP_HAVE_V4L2)
#elif defined(VISP_HAVE_OPENCV)
cv::VideoCapture g(device);
if (!g.isOpened()) {
std::cout << "Failed to open the camera" << std::endl;
return -1;
}
cv::Mat frame;
g >> frame;
#endif
#if defined(VISP_HAVE_X11)
#elif defined(VISP_HAVE_GDI)
#elif defined(VISP_HAVE_OPENCV)
#elif defined(VISP_HAVE_GTK)
#endif
bool init_done = false;
std::cout << "Click!!!" << std::endl;
while (1) {
try {
#if defined(VISP_HAVE_V4L2)
g.acquire(I);
#elif defined(VISP_HAVE_OPENCV)
g >> frame;
#endif
if (!init_done) {
init_done = true;
}
} else {
}
} catch (...) {
init_done = false;
}
}
#else
(void)argc;
(void)argv;
#endif
}