23 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
34 for (
int i=2; i<nrhs; i+=2) {
35 string key(rhs[i].toString());
37 color = (rhs[i+1].isChar()) ?
38 ColorType[rhs[i+1].toString()] : rhs[i+1].toScalar();
39 else if (key ==
"Thickness")
40 thickness = (rhs[i+1].isChar()) ?
42 else if (key ==
"LineType")
43 lineType = (rhs[i+1].isChar()) ?
44 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
45 else if (key ==
"Shift")
46 shift = rhs[i+1].toInt();
47 else if (key ==
"Closed")
48 isClosed = rhs[i+1].toBool();
51 "Unrecognized option %s", key.
c_str());
57 polylines(img, pts, isClosed, color, thickness, lineType, shift);
struct mxArray_tag mxArray
Forward declaration for mxArray.
void polylines(Mat &img, const Point *const *pts, const int *npts, int ncontours, bool isClosed, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
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...
const ConstMap< std::string, int > LineType
Line type for drawing.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
const ConstMap< std::string, int > ThicknessType
Thickness type for drawing.
Global constant definitions.
const ConstMap< std::string, cv::Scalar > ColorType
Translates MATLAB color names (see ColorSpec) into OpenCV scalars.