tutorial-visp-grabber-1394.cpp
Go to the documentation of this file.
1 #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 
14  g.setVideoMode(vp1394TwoGrabber::vpVIDEO_MODE_640x480_MONO8);
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);
28  vpDisplay::display(I);
29  vpDisplay::flush(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 }
d


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