23 nargchk(nrhs>=5 && (nrhs%2)==1 && nlhs<=1);
33 int flags = DrawMatchesFlags::DEFAULT;
34 for (
int i=5; i<nrhs; i+=2) {
35 string key(rhs[i].toString());
36 if (key ==
"MatchColor")
37 matchColor = (rhs[i+1].isChar()) ?
38 ColorType[rhs[i+1].toString()] : rhs[i+1].toScalar();
39 else if (key ==
"SinglePointColor")
40 singlePointColor = (rhs[i+1].isChar()) ?
41 ColorType[rhs[i+1].toString()] : rhs[i+1].toScalar();
42 else if (key ==
"MatchesMask")
43 rhs[i+1].toMat(
CV_8S).reshape(1,1).copyTo(matchesMask);
44 else if (key ==
"NotDrawSinglePoints")
46 DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS);
47 else if (key ==
"DrawRichKeypoints")
49 DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
50 else if (key ==
"OutImage") {
51 outImg = rhs[i+1].toMat(
CV_8U);
52 flags |= DrawMatchesFlags::DRAW_OVER_OUTIMG;
56 "Unrecognized option %s", key.
c_str());
63 keypoints2(rhs[3].toVector<KeyPoint>());
65 drawMatches(img1, keypoints1, img2, keypoints2, matches1to2, outImg,
66 matchColor, singlePointColor, matchesMask, flags);
void drawMatches(InputArray img1, const std::vector< KeyPoint > &keypoints1, InputArray img2, const std::vector< KeyPoint > &keypoints2, const std::vector< DMatch > &matches1to2, InputOutputArray outImg, const Scalar &matchColor=Scalar::all(-1), const Scalar &singlePointColor=Scalar::all(-1), const std::vector< char > &matchesMask=std::vector< char >(), int flags=DrawMatchesFlags::DEFAULT)
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
struct mxArray_tag mxArray
Forward declaration for mxArray.
#define UPDATE_FLAG(NUM, TF, BIT)
set or clear a bit in flag depending on bool value
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Global constant definitions.
const ConstMap< std::string, cv::Scalar > ColorType
Translates MATLAB color names (see ColorSpec) into OpenCV scalars.
static Scalar_< double > all(double v0)