moved matchesMask

This commit is contained in:
Maria Dimashova 2010-06-12 14:39:56 +00:00
parent 008da75691
commit dd72f2ec52
4 changed files with 16 additions and 17 deletions

View File

@ -1962,12 +1962,12 @@ This function draws matches of keypints from two images on output image.
Match is a line connecting two keypoints (circles). Match is a line connecting two keypoints (circles).
\cvdefCpp{ \cvdefCpp{
void drawMatches( const Mat\& img1, const vector<KeyPoint>\& keypoints1, void drawMatches( const Mat\& img1, const vector<KeyPoint>\& keypoints1,
const Mat\& img2, const vector<KeyPoint>\& keypoints2, const Mat\& img2, const vector<KeyPoint>\& keypoints2,
const vector<int>\& matches, Mat\& outImg, const vector<int>\& matches, Mat\& outImg,
const vector<char>\& matchesMask = vector<char>(), const Scalar\& matchColor = Scalar::all(-1),
const Scalar\& matchColor = Scalar::all(-1), const Scalar\& singlePointColor = Scalar::all(-1),
const Scalar\& singlePointColor = Scalar::all(-1), const vector<char>\& matchesMask = vector<char>(),
int flags = DrawMatchesFlags::DEFAULT ); int flags = DrawMatchesFlags::DEFAULT );
} }
@ -1995,10 +1995,6 @@ void drawMatches( const Mat\& img1, const vector<KeyPoint>\& 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. } \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} \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} \begin{description}
\cvarg{matchColor}{Color of matches (lines and connected keypoints). If \texttt{matchColor}==Scalar::all(-1) color will be generated randomly.} \cvarg{matchColor}{Color of matches (lines and connected keypoints). If \texttt{matchColor}==Scalar::all(-1) color will be generated randomly.}
\end{description} \end{description}
@ -2007,6 +2003,10 @@ void drawMatches( const Mat\& img1, const vector<KeyPoint>\& 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.} \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} \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} \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. } \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} \end{description}

View File

@ -2139,9 +2139,9 @@ struct CV_EXPORTS DrawMatchesFlags
// Draws matches of keypints from two images on output image. // Draws matches of keypints from two images on output image.
CV_EXPORTS void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, CV_EXPORTS void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1,
const Mat& img2, const vector<KeyPoint>& keypoints2, const Mat& img2, const vector<KeyPoint>& keypoints2,
const vector<int>& matches, Mat& outImg, const vector<char>& matchesMask = vector<char>(), const vector<int>& matches, Mat& outImg,
const Scalar& matchColor = Scalar::all(-1), const Scalar& singlePointColor = Scalar::all(-1), const Scalar& matchColor = Scalar::all(-1), const Scalar& singlePointColor = Scalar::all(-1),
int flags = DrawMatchesFlags::DEFAULT ); const vector<char>& matchesMask = vector<char>(), int flags = DrawMatchesFlags::DEFAULT );
} }

View File

@ -47,9 +47,9 @@ namespace cv
void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1, void drawMatches( const Mat& img1, const vector<KeyPoint>& keypoints1,
const Mat& img2,const vector<KeyPoint>& keypoints2, const Mat& img2,const vector<KeyPoint>& keypoints2,
const vector<int>& matches, Mat& outImg, const vector<char>& matchesMask, const vector<int>& matches, Mat& outImg,
const Scalar& matchColor, const Scalar& singlePointColor, const Scalar& matchColor, const Scalar& singlePointColor,
int flags ) const vector<char>& matchesMask, int flags )
{ {
Size size( img1.cols + img2.cols, MAX(img1.rows, img2.rows) ); Size size( img1.cols + img2.cols, MAX(img1.rows, img2.rows) );
if( flags & DrawMatchesFlags::DRAW_OVER_OUTIMG ) if( flags & DrawMatchesFlags::DRAW_OVER_OUTIMG )

View File

@ -1,4 +1,3 @@
//#include <cvaux.h>
#include <highgui.h> #include <highgui.h>
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#include "opencv2/calib3d/calib3d.hpp" #include "opencv2/calib3d/calib3d.hpp"
@ -98,16 +97,16 @@ void doIteration( const Mat& img1, Mat& img2, bool isWarpPerspective,
matchesMask[i1] = 1; matchesMask[i1] = 1;
} }
// draw inliers // 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 // draw outliers
/*for( size_t i1 = 0; i1 < matchesMask.size(); i1++ ) /*for( size_t i1 = 0; i1 < matchesMask.size(); i1++ )
matchesMask[i1] = !matchesMask[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 );*/ DrawMatchesFlags::DRAW_OVER_OUTIMG | DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );*/
} }
else else
{ {
drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, vector<char>(), CV_RGB(0, 255, 0) ); drawMatches( img1, keypoints1, img2, keypoints2, matches, drawImg, CV_RGB(0, 255, 0) );
} }
imshow( winName, drawImg ); imshow( winName, drawImg );