opencv/modules/features2d/doc/drawing_function_of_keypoints_and_matches.rst

78 lines
4.1 KiB
ReStructuredText
Raw Normal View History

Drawing Function of Keypoints and Matches
=========================================
.. index:: drawMatches
drawMatches
---------------
.. c:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<DMatch>& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<char>& matchesMask=vector<char>(), int flags=DrawMatchesFlags::DEFAULT )
2011-03-03 08:29:55 +01:00
.. c:function:: void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, const Mat& img2, const vector<KeyPoint>& keypoints2, const vector<vector<DMatch> >& matches1to2, Mat& outImg, const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), const vector<vector<char>>& matchesMask= vector<vector<char> >(), int flags=DrawMatchesFlags::DEFAULT )
2011-05-08 11:09:39 +02:00
:param img1: The first source image.
2011-05-08 11:09:39 +02:00
:param keypoints1: Keypoints from the first source image.
2011-05-08 11:09:39 +02:00
:param img2: The second source image.
2011-05-08 11:09:39 +02:00
:param keypoints2: Keypoints from the second source image.
2011-02-26 12:05:10 +01:00
2011-05-08 11:09:39 +02:00
:param matches: Matches from the first image to the second one, which means that ``keypoints1[i]`` has a corresponding point in ``keypoints2[matches[i]]`` .
2011-05-08 11:09:39 +02:00
:param outImg: Output image. Its content depends on the ``flags`` value defining what is drawn in the output image. See possible ``flags`` bit values below.
2011-05-08 11:09:39 +02:00
:param matchColor: Color of matches (lines and connected keypoints). If ``matchColor==Scalar::all(-1)`` , the color is generated randomly.
2011-05-08 11:09:39 +02:00
:param singlePointColor: Color of single keypoints (circles), which means that keypoints do not have the matches. If ``singlePointColor==Scalar::all(-1)`` , the color is generated randomly.
2011-05-08 11:09:39 +02:00
:param matchesMask: Mask determining which matches are drawn. If the mask is empty, all matches are drawn.
2011-02-26 12:05:10 +01:00
2011-05-08 11:09:39 +02:00
:param flags: Flags setting drawing features. Possible ``flags`` bit values are defined by ``DrawMatchesFlags``.
This function draws matches of keypoints from two images in the output image. Match is a line connecting two keypoints (circles). The structure ``DrawMatchesFlags`` is defined as follows:
.. code-block:: cpp
struct DrawMatchesFlags
{
enum
{
DEFAULT = 0, // Output image matrix will be created (Mat::create),
// i.e. existing memory of output image may be reused.
2011-05-08 11:09:39 +02:00
// Two source images, matches, and single keypoints
// will be drawn.
2011-05-08 11:09:39 +02:00
// For each keypoint, only the center point will be
// drawn (without a circle around the keypoint with the
// keypoint size and orientation).
DRAW_OVER_OUTIMG = 1, // Output image matrix will not be
// created (using Mat::create). Matches will be drawn
// on existing content of output image.
NOT_DRAW_SINGLE_POINTS = 2, // Single keypoints will not be drawn.
2011-05-08 11:09:39 +02:00
DRAW_RICH_KEYPOINTS = 4 // For each keypoint, the circle around
// keypoint with keypoint size and orientation will
// be drawn.
};
};
..
.. index:: drawKeypoints
drawKeypoints
-----------------
2011-03-03 08:29:55 +01:00
.. c:function:: void drawKeypoints( const Mat& image, const vector<KeyPoint>& keypoints, Mat& outImg, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT )
2011-05-08 11:09:39 +02:00
Draws keypoints.
2011-02-26 12:05:10 +01:00
:param image: Source image.
2011-05-08 11:09:39 +02:00
:param keypoints: Keypoints from the source image.
2011-02-26 12:05:10 +01:00
2011-05-08 11:09:39 +02:00
:param outImg: Output image. Its content depends on the ``flags`` value defining what is drawn in the output image. See possible ``flags`` bit values below.
2011-03-03 08:29:55 +01:00
:param color: Color of keypoints.
2011-05-08 11:09:39 +02:00
:param flags: Flags setting drawing features. Possible ``flags`` bit values are defined by ``DrawMatchesFlags``. See details above in :ref:`drawMatches` .