File: tutorial-grabber-CMU1394.cpp

package info (click to toggle)
visp 3.6.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 119,296 kB
  • sloc: cpp: 500,914; ansic: 52,904; xml: 22,642; python: 7,365; java: 4,247; sh: 482; makefile: 237; objc: 145
file content (40 lines) | stat: -rw-r--r-- 994 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*! \example tutorial-grabber-CMU1394.cpp */
#include <visp3/core/vpImage.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/sensor/vp1394CMUGrabber.h>

int main()
{
#ifdef VISP_HAVE_CMU1394
  try {
    vpImage<unsigned char> I;

    vp1394CMUGrabber g;
    g.setVideoMode(0, 1); // 640x480 MONO8
    g.setAutoShutter();
    g.setAutoGain();
    g.setFramerate(4); // 30 fps
    g.open(I);

    std::cout << "Image size: " << I.getWidth() << " " << I.getHeight() << std::endl;

#ifdef VISP_HAVE_GDI
    vpDisplayGDI d(I);
#else
    std::cout << "No image viewer is available..." << std::endl;
#endif

    while (1) {
      g.acquire(I);
      vpDisplay::display(I);
      vpDisplay::flush(I);
      if (vpDisplay::getClick(I, false)) // A click to exit
        break;
    }
  } catch (const vpException &e) {
    std::cout << "Catch an exception: " << e << std::endl;
  }
#else
  std::cout << "Install CMU1394 SDK, configure and build ViSP again to use this example" << std::endl;
#endif
}