Table of Contents

Introduction

This tutorial focuses on keypoints detection and matching. You will learn how to detect keypoints on a reference image considered here as the first image of an mpeg video. Then in the next images of the video, keypoints that match those detected in the reference image are displayed. To leverage keypoints detection and matching capabilities ViSP should be build with OpenCV 3rd party.

Note that all the material (source code and video) described in this tutorial is part of ViSP source code and could be downloaded using the following command:

Here after is the resulting video. The left image represents the reference image. The right images correspond to the successive images of the input video. All the green lines extremities represent the points that are matched.

Now, let us explain the lines dedicated to the ORB keypoint detection and matching usage.

First we have to include the header of the vpKeyPoint class that is a wrapper over OpenCV classes.

#include <visp3/vision/vpKeyPoint.h>

Note that this class is only available if ViSP was build with OpenCV. This is ensured by the check of VISP_HAVE_OPENCV_VERSION macro.

#if (VISP_HAVE_OPENCV_VERSION >= 0x020101)

Then we open the mpeg video stream and grab the first image of the video that is stored in I container. The vpKeyPoint class is instantiated and keypoints are detected on the first image which is considered as the reference image:

Using others types of keypoints

Using other types of detectors / descriptors (SIFT, SURF, etc.) or matchers (Brute Force, Flann based matcher) is also possible. This can be easily done by using the correct OpenCV identifier name. For example, if you want to use the couple of detector / descriptor SIFT with a matching using FLANN, you only have to change the following lines :

Available types of detectors, extractors or matchers depend on OpenCV version. Check the OpenCV documentation to know which ones are available.

Due to some patents, SIFT and SURF keypoints are available in a separate module in OpenCV: in nonfree module in OpenCV version before 3.0.0 and in xfeatures2d in OpenCV version from 3.0.0 if OpenCV contrib modules are build. If you want to use them, be sure that you have the nonfree module or xfeatures2d module.

Some usage restrictions could also exist according to the usage you plan (e.g. research or commercial use).