ViSP  2.8.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
10 
11  vpV4l2Grabber g;
12  g.open(I);
13 
14  std::cout << "Image size: " << I.getWidth() << " " << I.getHeight() << std::endl;
15 
16 #ifdef VISP_HAVE_X11
17  vpDisplayX d(I);
18 #else
19  std::cout << "No image viewer is available..." << std::endl;
20 #endif
21 
22  while(1) {
23  g.acquire(I);
26  if (vpDisplay::getClick(I, false)) break;
27  }
28 #endif
29 }
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
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1991
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:203
Class for the Video4Linux2 video device.
unsigned int getHeight() const
Definition: vpImage.h:150
virtual bool getClick(bool blocking=true)=0