ViSP  2.9.0
tutorial-grabber-v4l2.cpp
1 
2 #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 {
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);
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 }
void acquire(vpImage< unsigned char > &I)
void open(vpImage< unsigned char > &I)
unsigned int getWidth() const
Definition: vpImage.h:159
Define the X11 console to display images.
Definition: vpDisplayX.h:152
error that can be emited by ViSP classes.
Definition: vpException.h:76
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1994
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:206
Class for the Video4Linux2 video device.
unsigned int getHeight() const
Definition: vpImage.h:150
virtual bool getClick(bool blocking=true)=0