23 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
34 int maxLevel = INT_MAX;
36 for (
int i=2; i<nrhs; i+=2) {
37 string key(rhs[i].toString());
38 if (key ==
"ContourIdx")
39 contourIdx = rhs[i+1].toInt();
40 else if (key ==
"Color")
41 color = (rhs[i+1].isChar()) ?
42 ColorType[rhs[i+1].toString()] : rhs[i+1].toScalar();
43 else if (key ==
"Thickness")
44 thickness = (rhs[i+1].isChar()) ?
46 else if (key ==
"LineType")
47 lineType = (rhs[i+1].isChar()) ?
48 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
49 else if (key ==
"Hierarchy")
51 hierarchy = rhs[i+1].toVector<
Vec4i>();
52 else if (key ==
"MaxLevel")
53 maxLevel = rhs[i+1].toInt();
54 else if (key ==
"Offset")
55 offset = rhs[i+1].toPoint();
58 "Unrecognized option %s", key.
c_str());
64 drawContours(image, contours, contourIdx, color, thickness, lineType,
65 hierarchy, maxLevel, offset);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
struct mxArray_tag mxArray
Forward declaration for mxArray.
void drawContours(InputOutputArray image, InputArrayOfArrays contours, int contourIdx, const Scalar &color, int thickness=1, int lineType=LINE_8, InputArray hierarchy=noArray(), int maxLevel=INT_MAX, Point offset=Point())
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.
static Scalar_< double > all(double v0)