ViSP  2.10.0
tutorial-matching-surf-deprecated.cpp
1 #include <visp/vpDisplayOpenCV.h>
3 #include <visp/vpVideoReader.h>
5 #include <visp/vpKeyPointSurf.h>
7 
8 int main()
9 {
11 #if defined(VISP_HAVE_OPENCV_NONFREE) && (VISP_HAVE_OPENCV_VERSION < 0x030000)
14 
15  vpVideoReader reader;
16  reader.setFileName("video-postcard.mpeg");
17  reader.acquire(I);
18 
20  vpKeyPointSurf surf;
21  surf.buildReference(I);
23 
26  Idisp.resize(I.getHeight(), 2*I.getWidth());
27  Idisp.insert(I, vpImagePoint(0, 0));
28  Idisp.insert(I, vpImagePoint(0, I.getWidth()));
31  vpDisplayOpenCV d(Idisp, 0, 0, "Matching surf keypoints") ;
32  vpDisplay::display(Idisp);
33  vpDisplay::flush(Idisp);
35 
36  while ( ! reader.end() )
37  {
39  reader.acquire(I);
40  Idisp.insert(I, vpImagePoint(0, I.getWidth()));
42 
44  vpDisplay::display(Idisp);
47 
49  int nbMatch = surf.matchPoint(I);
51 
53  vpImagePoint iPref, iPcur;
54  for (int i = 0; i < nbMatch; i++)
55  {
56  surf.getMatchedPoints(i, iPref, iPcur);
59  vpDisplay::displayLine(Idisp, iPref, iPcur + vpImagePoint(0, I.getWidth()), vpColor::green);
61  }
63  vpDisplay::flush(Idisp);
65 
66  if (vpDisplay::getClick(Idisp, false))
67  break;
68  }
69 
70  vpDisplay::getClick(Idisp);
71 #endif
72 
73  return 0;
74 }
unsigned int getWidth() const
Definition: vpImage.h:161
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
unsigned int matchPoint(const vpImage< unsigned char > &I)
void getMatchedPoints(const unsigned int index, vpImagePoint &referencePoint, vpImagePoint &currentPoint)
static const vpColor green
Definition: vpColor.h:170
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:2232
Class that implements the SURF key points and technics thanks to OpenCV library.
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:210
The vpDisplayOpenCV allows to display image using the opencv library.
void acquire(vpImage< vpRGBa > &I)
void resize(const unsigned int h, const unsigned int w)
set the size of the image without initializing it.
Definition: vpImage.h:536
void setFileName(const char *filename)
unsigned int buildReference(const vpImage< unsigned char > &I)
void insert(const vpImage< Type > &src, const vpImagePoint topLeft)
Definition: vpImage.h:855
unsigned int getHeight() const
Definition: vpImage.h:152
virtual bool getClick(bool blocking=true)=0
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:93
virtual void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
static const vpColor white
Definition: vpColor.h:162