ViSP  2.9.0
tutorial-blob-tracker.cpp
1 
4 #include <visp/vp1394CMUGrabber.h>
5 #include <visp/vp1394TwoGrabber.h>
6 #include <visp/vpDisplayGDI.h>
7 #include <visp/vpDisplayX.h>
8 #include <visp/vpDot2.h>
9 
10 int main()
11 {
12 #if (defined(VISP_HAVE_DC1394_2) || defined(VISP_HAVE_CMU1394))
13  try {
14  vpImage<unsigned char> I; // Create a gray level image container
15 
16 #if defined(VISP_HAVE_DC1394_2)
17  vp1394TwoGrabber g(false);
18 #elif defined(VISP_HAVE_CMU1394)
20 #endif
21  g.open(I);
22  g.acquire(I);
23 
24 #if defined(VISP_HAVE_X11)
25  vpDisplayX d(I, 0, 0, "Camera view");
26 #elif defined(VISP_HAVE_GDI)
27  vpDisplayGDI d(I, 0, 0, "Camera view");
28 #else
29  std::cout << "No image viewer is available..." << std::endl;
30 #endif
33 
34  vpDot2 blob;
35  blob.setGraphics(true);
36  blob.setGraphicsThickness(2);
37  blob.initTracking(I);
38 
39  while(1) {
40  g.acquire(I); // Acquire an image
42  blob.track(I);
44  if (vpDisplay::getClick(I, false))
45  break;
46  }
47  }
48  catch(vpException e) {
49  std::cout << "Catch an exception: " << e << std::endl;
50  }
51 #endif
52 }
void open(vpImage< unsigned char > &I)
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:132
Define the X11 console to display images.
Definition: vpDisplayX.h:152
error that can be emited by ViSP classes.
Definition: vpException.h:76
This tracker is meant to track a blob (connex pixels with same gray level) on a vpImage.
Definition: vpDot2.h:127
void track(const vpImage< unsigned char > &I)
Definition: vpDot2.cpp:465
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1994
void setGraphicsThickness(unsigned int t)
Definition: vpDot2.h:318
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
void acquire(vpImage< unsigned char > &I)
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:206
void initTracking(const vpImage< unsigned char > &I, unsigned int size=0)
Definition: vpDot2.cpp:266
Class for firewire ieee1394 video devices using libdc1394-2.x api.
virtual bool getClick(bool blocking=true)=0
void setGraphics(const bool activate)
Definition: vpDot2.h:312