ViSP  2.9.0
tutorial-me-ellipse-tracker.cpp
1 
2 #include <visp/vp1394CMUGrabber.h>
3 #include <visp/vp1394TwoGrabber.h>
4 #include <visp/vpV4l2Grabber.h>
5 #include <visp/vpDisplayGDI.h>
6 #include <visp/vpDisplayX.h>
7 #include <visp/vpMeEllipse.h>
8 
9 int main()
10 {
11 #if (defined(VISP_HAVE_DC1394_2) || defined(VISP_HAVE_CMU1394) || defined(VISP_HAVE_V4L2))
12  try {
14 
15 #if defined(VISP_HAVE_DC1394_2)
16  vp1394TwoGrabber g(false);
17 #elif defined(VISP_HAVE_CMU1394)
19 #elif defined(VISP_HAVE_V4L2)
20  vpV4l2Grabber g;
21 #endif
22  g.open(I);
23  g.acquire(I);
24 
25 #if defined(VISP_HAVE_X11)
26  vpDisplayX d(I, 0, 0, "Camera view");
27 #elif defined(VISP_HAVE_GDI)
28  vpDisplayGDI d(I, 0, 0, "Camera view");
29 #else
30  std::cout << "No image viewer is available..." << std::endl;
31 #endif
32 
35 
36  vpMe me;
37  me.setRange(25);
38  me.setThreshold(15000);
39  me.setSampleStep(10);
40 
41  vpMeEllipse ellipse;
42  ellipse.setMe(&me);
44  ellipse.initTracking(I);
45 
46  while(1) {
47  g.acquire(I);
49  ellipse.track(I);
50  ellipse.display(I, vpColor::red);
52  }
53  }
54  catch(vpException e) {
55  std::cout << "Catch an exception: " << e << std::endl;
56  }
57 #endif
58 }
void acquire(vpImage< unsigned char > &I)
void initTracking(const vpImage< unsigned char > &I)
void open(vpImage< unsigned char > &I)
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:132
void setSampleStep(const double &s)
Definition: vpMe.h:271
Define the X11 console to display images.
Definition: vpDisplayX.h:152
error that can be emited by ViSP classes.
Definition: vpException.h:76
Class that tracks an ellipse moving edges.
Definition: vpMeEllipse.h:142
Contains predetermined masks for sites and holds moving edges tracking parameters.
Definition: vpMe.h:70
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1994
static const vpColor red
Definition: vpColor.h:167
void track(const vpImage< unsigned char > &Im)
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
void setDisplay(vpMeSite::vpMeSiteDisplayType select)
Definition: vpMeTracker.h:108
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:206
void display(const vpImage< unsigned char > &I, vpColor col)
Class for the Video4Linux2 video device.
void setThreshold(const double &t)
Definition: vpMe.h:299
Class for firewire ieee1394 video devices using libdc1394-2.x api.
void setRange(const unsigned int &r)
Definition: vpMe.h:229
void setMe(vpMe *p_me)
Definition: vpMeTracker.h:140