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


visp_ros
Author(s): Francois Pasteau, Fabien Spindler, Gatien Gaumerais, Alexander Oliva
autogenerated on Tue Mar 1 2022 00:03:22