File: drawing_function_of_keypoints_and_matches.rst

package info (click to toggle)
opencv 2.4.9.1%2Bdfsg-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 126,800 kB
  • ctags: 62,729
  • sloc: xml: 509,055; cpp: 490,794; lisp: 23,208; python: 21,174; java: 19,317; ansic: 1,038; sh: 128; makefile: 72
file content (78 lines) | stat: -rw-r--r-- 4,020 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Drawing Function of Keypoints and Matches
=========================================



drawMatches
---------------
Draws the found matches of keypoints from two images.

.. ocv: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 )

.. ocv: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 )


    :param img1: First source image.

    :param keypoints1: Keypoints from the first source image.

    :param img2: Second source image.

    :param keypoints2: Keypoints from the second source image.

    :param matches1to2: Matches from the first image to the second one, which means that  ``keypoints1[i]``  has a corresponding point in  ``keypoints2[matches[i]]`` .

    :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.

    :param matchColor: Color of matches (lines and connected keypoints). If  ``matchColor==Scalar::all(-1)`` , the color is generated randomly.

    :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.

    :param matchesMask: Mask determining which matches are drawn. If the mask is empty, all matches are drawn.

    :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.
                         // Two source images, matches, and single keypoints
                         // will be drawn.
                         // 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.
            DRAW_RICH_KEYPOINTS = 4 // For each keypoint, the circle around
                           // keypoint with keypoint size and orientation will
                           // be drawn.
        };
    };

..



drawKeypoints
-----------------
Draws keypoints.

.. ocv:function:: void drawKeypoints( const Mat& image, const vector<KeyPoint>& keypoints, Mat& outImage, const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT )

    :param image: Source image.

    :param keypoints: Keypoints from the source image.

    :param outImage: Output image. Its content depends on  the ``flags``  value defining what is drawn in the output image. See possible  ``flags``  bit values below.

    :param color: Color of keypoints.

    :param flags: Flags setting drawing features. Possible  ``flags``  bit values are defined by  ``DrawMatchesFlags``. See details above in  :ocv:func:`drawMatches` .