Visual Servoing Platform  version 3.5.1 under development (2023-06-19)
tutorial-matching-surf-deprecated.cpp
1 #include <visp3/gui/vpDisplayOpenCV.h>
3 #include <visp3/io/vpVideoReader.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.mp4");
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()) {
38  reader.acquire(I);
39  Idisp.insert(I, vpImagePoint(0, I.getWidth()));
41 
43  vpDisplay::display(Idisp);
45  vpColor::white, 2);
47 
49  unsigned int nbMatch = surf.matchPoint(I);
51 
53  vpImagePoint iPref, iPcur;
54  for (unsigned int i = 0; i < nbMatch; i++) {
55  surf.getMatchedPoints(i, iPref, iPcur);
58  vpDisplay::displayLine(Idisp, iPref, iPcur + vpImagePoint(0, I.getWidth()), vpColor::green);
60  }
62  vpDisplay::flush(Idisp);
64 
65  if (vpDisplay::getClick(Idisp, false))
66  break;
67  }
68 
69  vpDisplay::getClick(Idisp);
70 #endif
71 
72  return EXIT_SUCCESS;
73 }
static const vpColor white
Definition: vpColor.h:212
static const vpColor green
Definition: vpColor.h:220
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
static void flush(const vpImage< unsigned char > &I)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:89
unsigned int getWidth() const
Definition: vpImage.h:247
void resize(unsigned int h, unsigned int w)
resize the image : Image initialization
Definition: vpImage.h:800
void insert(const vpImage< Type > &src, const vpImagePoint &topLeft)
Definition: vpImage.h:1359
unsigned int getHeight() const
Definition: vpImage.h:189
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
void acquire(vpImage< vpRGBa > &I)
void setFileName(const std::string &filename)
Class that implements the SURF key points and technics thanks to the OpenCV library.