From 008da756918704ec7645d4d843a9ff0c5dec7b18 Mon Sep 17 00:00:00 2001 From: Maria Dimashova Date: Sat, 12 Jun 2010 10:11:57 +0000 Subject: [PATCH] renamed parameter of drawMatches (mask to matchesMask) --- doc/cv_feature_detection.tex | 6 +++--- .../include/opencv2/features2d/features2d.hpp | 4 ++-- modules/features2d/src/descriptors.cpp | 14 +++++++------- samples/cpp/descriptor_extractor_matcher.cpp | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/cv_feature_detection.tex b/doc/cv_feature_detection.tex index 9559b0cee3..d7eddfd2b4 100644 --- a/doc/cv_feature_detection.tex +++ b/doc/cv_feature_detection.tex @@ -1965,7 +1965,7 @@ Match is a line connecting two keypoints (circles). void drawMatches( const Mat\& img1, const vector\& keypoints1, const Mat\& img2, const vector\& keypoints2, const vector\& matches, Mat\& outImg, - const vector\& mask = vector(), + const vector\& matchesMask = vector(), const Scalar\& matchColor = Scalar::all(-1), const Scalar\& singlePointColor = Scalar::all(-1), int flags = DrawMatchesFlags::DEFAULT ); @@ -1996,7 +1996,7 @@ void drawMatches( const Mat\& img1, const vector\& keypoints1, \end{description} \begin{description} -\cvarg{mask}{Mask determining which matches will be drawn. If mask is empty all matches will be drawn. } +\cvarg{matchesMask}{Mask determining which matches will be drawn. If mask is empty all matches will be drawn. } \end{description} \begin{description} @@ -2015,7 +2015,7 @@ void drawMatches( const Mat\& img1, const vector\& keypoints1, struct DrawMatchesFlags { enum{ DEFAULT = 0, // Output image matrix will be created (Mat::create), - // i.e. existing memory of output image will be reused. + // i.e. existing memory of output image may be reused. // Two source image, matches and single keypoints will be drawn. DRAW_OVER_OUTIMG = 1, // Output image matrix will not be created (Mat::create). // Matches will be drawn on existing content diff --git a/modules/features2d/include/opencv2/features2d/features2d.hpp b/modules/features2d/include/opencv2/features2d/features2d.hpp index debdec8c6e..7901993708 100644 --- a/modules/features2d/include/opencv2/features2d/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d/features2d.hpp @@ -2128,7 +2128,7 @@ protected: struct CV_EXPORTS DrawMatchesFlags { enum{ DEFAULT = 0, // Output image matrix will be created (Mat::create), - // i.e. existing memory of output image will be reused. + // i.e. existing memory of output image may be reused. // Two source image, matches and single keypoints will be drawn. DRAW_OVER_OUTIMG = 1, // Output image matrix will not be created (Mat::create). // Matches will be drawn on existing content of output image. @@ -2139,7 +2139,7 @@ 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& mask = vector(), + const vector& matches, Mat& outImg, const vector& matchesMask = vector(), const Scalar& matchColor = Scalar::all(-1), const Scalar& singlePointColor = Scalar::all(-1), int flags = DrawMatchesFlags::DEFAULT ); diff --git a/modules/features2d/src/descriptors.cpp b/modules/features2d/src/descriptors.cpp index c4b6c8ef42..ed492afeb2 100644 --- a/modules/features2d/src/descriptors.cpp +++ b/modules/features2d/src/descriptors.cpp @@ -45,11 +45,11 @@ using namespace std; namespace cv { -CV_EXPORTS void drawMatches( const Mat& img1, const vector& keypoints1, - const Mat& img2,const vector& keypoints2, - const vector& matches, Mat& outImg, const vector& mask, - const Scalar& matchColor, const Scalar& singlePointColor, - int flags ) +void drawMatches( const Mat& img1, const vector& keypoints1, + const Mat& img2,const vector& keypoints2, + const vector& matches, Mat& outImg, const vector& matchesMask, + const Scalar& matchColor, const Scalar& singlePointColor, + int flags ) { Size size( img1.cols + img2.cols, MAX(img1.rows, img2.rows) ); if( flags & DrawMatchesFlags::DRAW_OVER_OUTIMG ) @@ -88,12 +88,12 @@ CV_EXPORTS void drawMatches( const Mat& img1, const vector& keypoints1 bool isRandMatchColor = matchColor == Scalar::all(-1); if( matches.size() != keypoints1.size() ) CV_Error( CV_StsBadSize, "matches must have the same size as keypoints1" ); - if( !mask.empty() && mask.size() != keypoints1.size() ) + if( !matchesMask.empty() && matchesMask.size() != keypoints1.size() ) CV_Error( CV_StsBadSize, "mask must have the same size as keypoints1" ); vector::const_iterator mit = matches.begin(); for( int i1 = 0; mit != matches.end(); ++mit, i1++ ) { - if( (mask.empty() || mask[i1] ) && *mit >= 0 ) + if( (matchesMask.empty() || matchesMask[i1] ) && *mit >= 0 ) { Point2f pt1 = keypoints1[i1].pt, pt2 = keypoints2[*mit].pt, diff --git a/samples/cpp/descriptor_extractor_matcher.cpp b/samples/cpp/descriptor_extractor_matcher.cpp index f070e319fb..373222de57 100644 --- a/samples/cpp/descriptor_extractor_matcher.cpp +++ b/samples/cpp/descriptor_extractor_matcher.cpp @@ -88,21 +88,21 @@ void doIteration( const Mat& img1, Mat& img2, bool isWarpPerspective, Mat drawImg; if( !H12.empty() ) { - vector mask( matches.size(), 0 ); + vector matchesMask( matches.size(), 0 ); vector::const_iterator mit = matches.begin(); for( size_t i1 = 0; mit != matches.end(); ++mit, i1++ ) { Point2f pt1 = keypoints1[i1].pt, pt2 = keypoints2[*mit].pt; if( norm(pt2 - applyHomography(H12, pt1)) < 4 ) // inlier - mask[i1] = 1; + matchesMask[i1] = 1; } // draw inliers - drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, mask, CV_RGB(0, 255, 0), CV_RGB(0, 0, 255) ); + drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, matchesMask, CV_RGB(0, 255, 0), CV_RGB(0, 0, 255) ); // draw outliers - /*for( size_t i1 = 0; i1 < mask.size(); i1++ ) - mask[i1] = !mask[i1]; - drawMatches( img1, img2, keypoints1, keypoints2, matches, mask, drawImg, CV_RGB(0, 0, 255), CV_RGB(255, 0, 0), + /*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), DrawMatchesFlags::DRAW_OVER_OUTIMG | DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );*/ } else