29 bool rect_variant = (rhs[1].isCell() || (rhs[1].numel() % 4)==0);
30 nargchk(rect_variant ? ((nrhs%2)==0) : (nrhs>=3 && (nrhs%2)==1));
38 for (
int i=(rect_variant ? 2 : 3); i<nrhs; i+=2) {
39 string key(rhs[i].toString());
41 color = (rhs[i+1].isChar()) ?
42 ColorType[rhs[i+1].toString()] : rhs[i+1].toScalar();
43 else if (key ==
"Colors")
44 colors = MxArrayToVectorVec<double,4>(rhs[i+1]);
45 else if (key ==
"Thickness")
46 thickness = (rhs[i+1].isChar()) ?
48 else if (key ==
"LineType")
49 lineType = (rhs[i+1].isChar()) ?
50 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
51 else if (key ==
"Shift")
52 shift = rhs[i+1].toInt();
55 "Unrecognized option %s", key.
c_str());
61 Point pt1(rhs[1].toPoint()),
62 pt2(rhs[2].toPoint());
63 rectangle(img, pt1, pt2, color, thickness, lineType, shift);
66 if (rhs[1].isNumeric() && rhs[1].numel() == 4) {
67 Rect r(rhs[1].toRect());
68 rectangle(img, r, color, thickness, lineType, shift);
74 for (
size_t i = 0; i < r.
size(); ++i)
77 thickness, lineType, shift);
void rectangle(InputOutputArray img, Point pt1, Point pt2, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
struct mxArray_tag mxArray
Forward declaration for mxArray.
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.