tutorial-visp-grabber-v4l2.cpp
Go to the documentation of this file.
1 #include <visp/vpV4l2Grabber.h>
3 #include <visp/vpDisplayX.h>
4 #include <visp/vpImage.h>
5 
6 int main()
7 {
8 #ifdef VISP_HAVE_V4L2
9  try {
10  vpImage<unsigned char> I;
11 
12  vpV4l2Grabber g;
13  g.open(I);
14 
15  std::cout << "Image size: " << I.getWidth() << " " << I.getHeight() << std::endl;
16 
17 #ifdef VISP_HAVE_X11
18  vpDisplayX d(I);
19 #else
20  std::cout << "No image viewer is available..." << std::endl;
21 #endif
22 
23  while(1) {
24  g.acquire(I);
25  vpDisplay::display(I);
26  vpDisplay::flush(I);
27  if (vpDisplay::getClick(I, false)) break;
28  }
29  }
30  catch(vpException e) {
31  std::cout << "Catch an exception: " << e << std::endl;
32  }
33 #endif
34 }
d


visp_ros
Author(s): Francois Pasteau, Fabien Spindler, Gatien Gaumerais
autogenerated on Tue Feb 9 2021 03:40:20