diff --git a/doc/cv_feature_detection.tex b/doc/cv_feature_detection.tex index d7eddfd2b4..57261aedac 100644 --- a/doc/cv_feature_detection.tex +++ b/doc/cv_feature_detection.tex @@ -1962,12 +1962,12 @@ This function draws matches of keypints from two images on output image. Match is a line connecting two keypoints (circles). \cvdefCpp{ -void drawMatches( const Mat\& img1, const vector\& keypoints1, +void drawMatches( const Mat\& img1, const vector\& keypoints1, const Mat\& img2, const vector\& keypoints2, - const vector\& matches, Mat\& outImg, - const vector\& matchesMask = vector(), - const Scalar\& matchColor = Scalar::all(-1), - const Scalar\& singlePointColor = Scalar::all(-1), + const vector\& matches, Mat\& outImg, + const Scalar\& matchColor = Scalar::all(-1), + const Scalar\& singlePointColor = Scalar::all(-1), + const vector\& matchesMask = vector(), int flags = DrawMatchesFlags::DEFAULT ); } @@ -1995,10 +1995,6 @@ void drawMatches( const Mat\& img1, const vector\& keypoints1, \cvarg{outImg}{Output image. Its content depends on \texttt{flags} value what is drawn in output image. See below possible \texttt{flags} bit values. } \end{description} -\begin{description} -\cvarg{matchesMask}{Mask determining which matches will be drawn. If mask is empty all matches will be drawn. } -\end{description} - \begin{description} \cvarg{matchColor}{Color of matches (lines and connected keypoints). If \texttt{matchColor}==Scalar::all(-1) color will be generated randomly.} \end{description} @@ -2007,6 +2003,10 @@ void drawMatches( const Mat\& img1, const vector\& keypoints1, \cvarg{singlePointColor}{Color of single keypoints (circles), i.e. keypoints not having the matches. If \texttt{singlePointColor}==Scalar::all(-1) color will be generated randomly.} \end{description} +\begin{description} +\cvarg{matchesMask}{Mask determining which matches will be drawn. If mask is empty all matches will be drawn. } +\end{description} + \begin{description} \cvarg{flags}{Each bit of \texttt{flags} sets some feature of drawing. Possible \texttt{flags} bit values is defined by DrawMatchesFlags, see below. } \end{description} diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index 7901993708..a106d670a5 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -2139,9 +2139,9 @@ struct CV_EXPORTS DrawMatchesFlags // Draws matches of keypints from two images on output image. CV_EXPORTS void drawMatches( const Mat& img1, const vector& keypoints1, const Mat& img2, const vector& keypoints2, - const vector& matches, Mat& outImg, const vector& matchesMask = vector(), + const vector& matches, Mat& outImg, const Scalar& matchColor = Scalar::all(-1), const Scalar& singlePointColor = Scalar::all(-1), - int flags = DrawMatchesFlags::DEFAULT ); + const vector& matchesMask = vector(), int flags = DrawMatchesFlags::DEFAULT ); } diff --git a/modules/features2d/src/descriptors.cpp b/modules/features2d/src/descriptors.cpp index ed492afeb2..4f3f66ceec 100644 --- a/modules/features2d/src/descriptors.cpp +++ b/modules/features2d/src/descriptors.cpp @@ -47,9 +47,9 @@ namespace cv void drawMatches( const Mat& img1, const vector& keypoints1, const Mat& img2,const vector& keypoints2, - const vector& matches, Mat& outImg, const vector& matchesMask, + const vector& matches, Mat& outImg, const Scalar& matchColor, const Scalar& singlePointColor, - int flags ) + const vector& matchesMask, int flags ) { Size size( img1.cols + img2.cols, MAX(img1.rows, img2.rows) ); if( flags & DrawMatchesFlags::DRAW_OVER_OUTIMG ) diff --git a/samples/cpp/descriptor_extractor_matcher.cpp b/samples/cpp/descriptor_extractor_matcher.cpp index 373222de57..87644addb7 100644 --- a/samples/cpp/descriptor_extractor_matcher.cpp +++ b/samples/cpp/descriptor_extractor_matcher.cpp @@ -1,4 +1,3 @@ -//#include #include #include "opencv2/core/core.hpp" #include "opencv2/calib3d/calib3d.hpp" @@ -98,16 +97,16 @@ void doIteration( const Mat& img1, Mat& img2, bool isWarpPerspective, matchesMask[i1] = 1; } // draw inliers - drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, matchesMask, CV_RGB(0, 255, 0), CV_RGB(0, 0, 255) ); + drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, CV_RGB(0, 255, 0), CV_RGB(0, 0, 255), matchesMask ); // draw outliers /*for( size_t i1 = 0; i1 < matchesMask.size(); i1++ ) matchesMask[i1] = !matchesMask[i1]; - drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, matchesMask, CV_RGB(0, 0, 255), CV_RGB(255, 0, 0), + drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, CV_RGB(0, 0, 255), CV_RGB(255, 0, 0), matchesMask, DrawMatchesFlags::DRAW_OVER_OUTIMG | DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );*/ } else { - drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, vector(), CV_RGB(0, 255, 0) ); + drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, CV_RGB(0, 255, 0) ); } imshow( winName, drawImg );