ViSP  2.9.0
tutorial-template-tracker.cpp
1 
2 #include <visp/vpDisplayGDI.h>
3 #include <visp/vpDisplayX.h>
4 #include <visp/vpImageIo.h>
5 #include <visp/vpTemplateTrackerSSDInverseCompositional.h>
6 #include <visp/vpTemplateTrackerWarpHomography.h>
7 
8 int main()
9 {
10 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)
12 
13  vpImageIo::readPGM(I, "pattern-template-tracker.pgm");
14 
15 #ifdef VISP_HAVE_X11
16  vpDisplayX display;
17 #else
18  vpDisplayGDI display;
19 #endif
20 
21  display.init(I, 100, 100, "Template tracker");
24 
26 
28 
29  tracker.setSampling(2,2);
30  tracker.setLambda(0.001);
31  tracker.setIterationMax(200);
32  tracker.setPyramidal(2, 1);
33 
34  tracker.initClick(I);
35 
36  while(1){
38  tracker.track(I);
39 
40  vpColVector p = tracker.getp();
41 
42  tracker.display(I, vpColor::red);
43 
44  if (vpDisplay::getClick(I, false))
45  break;
46 
48  vpTime::wait(40);
49  }
50 #endif
51 }
static void readPGM(vpImage< unsigned char > &I, const char *filename)
Definition: vpImageIo.cpp:972
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
static int wait(double t0, double t)
Definition: vpTime.cpp:149
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1994
static const vpColor red
Definition: vpColor.h:167
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:206
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
virtual bool getClick(bool blocking=true)=0