ViSP  2.8.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  vpImage<unsigned char> I; // Create a gray level image container
14 
15 #if defined(VISP_HAVE_DC1394_2)
16  vp1394TwoGrabber g(false);
17 #elif defined(VISP_HAVE_CMU1394)
19 #endif
20  g.open(I);
21  g.acquire(I);
22 
23 #if defined(VISP_HAVE_X11)
24  vpDisplayX d(I, 0, 0, "Camera view");
25 #elif defined(VISP_HAVE_GDI)
26  vpDisplayGDI d(I, 0, 0, "Camera view");
27 #else
28  std::cout << "No image viewer is available..." << std::endl;
29 #endif
32 
33  vpDot2 blob;
34  blob.setGraphics(true);
35  blob.setGraphicsThickness(2);
36  blob.initTracking(I);
37 
38  while(1) {
39  g.acquire(I); // Acquire an image
41  blob.track(I);
43  if (vpDisplay::getClick(I, false))
44  break;
45  }
46 #endif
47 }
void open(vpImage< unsigned char > &I)
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:133
Define the X11 console to display images.
Definition: vpDisplayX.h:152
This tracker is meant to track a blob (connex pixels with same gray level) on a vpImage.
Definition: vpDot2.h:131
void track(const vpImage< unsigned char > &I)
Definition: vpDot2.cpp:444
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1991
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:203
void setGraphicsThickness(unsigned int thickness)
Definition: vpDot2.h:318
void initTracking(const vpImage< unsigned char > &I, unsigned int size=0)
Definition: vpDot2.cpp:245
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