ViSP  2.9.0
tutorial-grabber-1394.cpp
1 
2 #include <visp/vp1394TwoGrabber.h>
3 #include <visp/vpDisplayX.h>
4 #include <visp/vpImage.h>
5 
6 int main()
7 {
8 #ifdef VISP_HAVE_DC1394_2
9  try {
10  vpImage<unsigned char> I; // Create a gray level image container
11  bool reset = true; // Enable bus reset during construction (default)
12  vp1394TwoGrabber g(reset); // Create a grabber based on libdc1394-2.x third party lib
13 
15  g.setFramerate(vp1394TwoGrabber::vpFRAMERATE_60);
16  g.open(I);
17 
18  std::cout << "Image size: " << I.getWidth() << " " << I.getHeight() << std::endl;
19 
20 #ifdef VISP_HAVE_X11
21  vpDisplayX d(I);
22 #else
23  std::cout << "No image viewer is available..." << std::endl;
24 #endif
25 
26  while(1) {
27  g.acquire(I);
30  if (vpDisplay::getClick(I, false))
31  break;
32  }
33  }
34  catch(vpException e) {
35  std::cout << "Catch an exception: " << e << std::endl;
36  }
37 #endif
38 }
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
unsigned int getHeight() const
Definition: vpImage.h:150
Class for firewire ieee1394 video devices using libdc1394-2.x api.
virtual bool getClick(bool blocking=true)=0