/**

\page tutorial-matching-deprecated Tutorial: Keypoint matching (deprecated)
\tableofcontents

\section intro_matching_deprecated Introduction

\note This tutorial is deprecated if your OpenCV version is equal to 3.0.0 or more recent. If so you should rather follow \ref tutorial-matching.

This tutorial focuses on SURF key points manipulation. You will learn how to detect SURF key points on a reference image considered here as the first image of an mpeg video. Then in the next images of the video, key points that match those detected in the reference image using SURF descriptor are displayed.

\note We assume that you are familiar with video framegrabbing described in \ref tutorial-grabber and with the way to display an image in a window described in \ref tutorial-getting-started.

\section surf_deprecated SURF key points detection and matching

Let us consider the following source code also available in tutorial-matching-surf-deprecated.cpp.

\include tutorial-matching-surf-deprecated.cpp

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.

\htmlonly
<iframe width="560" height="315" src="https://www.youtube.com/embed/sMbed_oYJgQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
\endhtmlonly

Now, let us explain the lines dedicated to the SURF keypoint usage.

First we have to include the header of the vpKeyPointSurf class that is a wrapper over OpenCV classes.
\snippet tutorial-matching-surf-deprecated.cpp Include

Note that this class is only available if ViSP was build with OpenCV non free module. This is ensured by the check of VISP_HAVE_OPENCV_NONFREE macro.
\snippet tutorial-matching-surf-deprecated.cpp Define

Then we open the mpeg video stream and grab the first image of the video that is stored in \c I container. A Surf keypoint class is instantiated and keypoints are detected on the first image which is considered as the reference image:
\snippet tutorial-matching-surf-deprecated.cpp Construction

The next lines are used to create image \c Idisp to render the matching results; left image for the reference image, right image for the current image that is processed:
\snippet tutorial-matching-surf-deprecated.cpp Create image

Then a display using OpenCV is created and image \c Idisp is rendered:
\snippet tutorial-matching-surf-deprecated.cpp Init display

We enter then in the \c while() loop where a new image is acquired from the video stream and inserted in the right part of image \c Idisp dedicated to rendering of the matching results.
\snippet tutorial-matching-surf-deprecated.cpp Acquisition

We start the rendering by displaying the rendered image and by drawing a white vertical line to separate the reference image from the current one:
\snippet tutorial-matching-surf-deprecated.cpp Display

Keypoint matches between the reference image and the current image \c I are detected using:
\snippet tutorial-matching-surf-deprecated.cpp Matching

Then we parse all the matches to retrieve the coordinates of the points in the reference image (in \c iPref variable) and in the current image (in \c iPcur variable):
\snippet tutorial-matching-surf-deprecated.cpp Get matches

Next we draw green lines between the matched points:
\snippet tutorial-matching-surf-deprecated.cpp Display matches

At the end of the iteration, we flush all the previous display to the render window:
\snippet tutorial-matching-surf-deprecated.cpp Display flush

You can now follow \ref tutorial-homography-deprecated to see how to exploit couple of matched points in order to estimate an homography that allows to track the position of an object.

*/
