Visual Servoing Platform  version 3.2.0
tutorial-matching-keypoint.cpp
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/io/vpVideoReader.h>
#include <visp3/vision/vpKeyPoint.h>
int main()
{
#if (VISP_HAVE_OPENCV_VERSION >= 0x020101)
vpVideoReader reader;
reader.setFileName("video-postcard.mpeg");
reader.acquire(I);
const std::string detectorName = "ORB";
const std::string extractorName = "ORB";
// Hamming distance must be used with ORB
const std::string matcherName = "BruteForce-Hamming";
vpKeyPoint keypoint(detectorName, extractorName, matcherName, filterType);
std::cout << "Reference keypoints=" << keypoint.buildReference(I) << std::endl;
Idisp.resize(I.getHeight(), 2 * I.getWidth());
Idisp.insert(I, vpImagePoint(0, 0));
Idisp.insert(I, vpImagePoint(0, I.getWidth()));
vpDisplayOpenCV d(Idisp, 0, 0, "Matching keypoints with ORB keypoints");
while (!reader.end()) {
reader.acquire(I);
Idisp.insert(I, vpImagePoint(0, I.getWidth()));
unsigned int nbMatch = keypoint.matchPoint(I);
std::cout << "Matches=" << nbMatch << std::endl;
vpImagePoint iPref, iPcur;
for (unsigned int i = 0; i < nbMatch; i++) {
keypoint.getMatchedPoints(i, iPref, iPcur);
}
if (vpDisplay::getClick(Idisp, false))
break;
}
#endif
return 0;
}
vpKeyPoint::buildReference
unsigned int buildReference(const vpImage< unsigned char > &I)
Definition: vpKeyPoint.cpp:235
vpKeyPoint::ratioDistanceThreshold
Definition: vpKeyPoint.h:237
vpVideoReader::end
bool end()
Definition: vpVideoReader.h:257
vpKeyPoint::vpFilterMatchingType
vpFilterMatchingType
Definition: vpKeyPoint.h:232
vpImage::insert
void insert(const vpImage< Type > &src, const vpImagePoint &topLeft)
Definition: vpImage.h:1187
vpKeyPoint::matchPoint
unsigned int matchPoint(const vpImage< unsigned char > &I)
Definition: vpKeyPoint.cpp:2886
vpDisplayOpenCV
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Definition: vpDisplayOpenCV.h:141
vpVideoReader
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
Definition: vpVideoReader.h:170
vpColor::green
static const vpColor green
Definition: vpColor.h:182
vpDisplay::display
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay_uchar.cpp:676
vpKeyPoint
Class that allows keypoints detection (and descriptors extraction) and matching thanks to OpenCV libr...
Definition: vpKeyPoint.h:227
vpImage::getHeight
unsigned int getHeight() const
Definition: vpImage.h:177
vpImagePoint
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:87
vpColor::white
static const vpColor white
Definition: vpColor.h:174
vpDisplay::flush
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay_uchar.cpp:652
vpBasicKeyPoint::getMatchedPoints
void getMatchedPoints(const unsigned int index, vpImagePoint &referencePoint, vpImagePoint &currentPoint)
Definition: vpBasicKeyPoint.h:137
vpImage< unsigned char >
vpDisplay::getClick
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
Definition: vpDisplay_uchar.cpp:701
vpDisplay::displayLine
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
Definition: vpDisplay_uchar.cpp:391
vpImage::resize
void resize(const unsigned int h, const unsigned int w)
resize the image : Image initialization
Definition: vpImage.h:865
vpVideoReader::acquire
void acquire(vpImage< vpRGBa > &I)
Definition: vpVideoReader.cpp:265
vpVideoReader::setFileName
void setFileName(const char *filename)
Definition: vpVideoReader.cpp:91
vpImage::getWidth
unsigned int getWidth() const
Definition: vpImage.h:238