29 bool rrect_variant = rhs[1].isStruct();
30 nargchk(rrect_variant ? ((nrhs%2)==0) : (nrhs>=3 && (nrhs%2)==1));
34 double startAngle = 0;
35 double endAngle = 360;
41 for (
int i=(rrect_variant ? 2 : 3); i<nrhs; i+=2) {
42 string key(rhs[i].toString());
43 if (key ==
"Angle" && !rrect_variant)
44 angle = rhs[i+1].toDouble();
45 else if (key ==
"StartAngle" && !rrect_variant)
46 startAngle = rhs[i+1].toDouble();
47 else if (key ==
"EndAngle" && !rrect_variant)
48 endAngle = rhs[i+1].toDouble();
49 else if (key ==
"Color")
50 color = (rhs[i+1].isChar()) ?
51 ColorType[rhs[i+1].toString()] : rhs[i+1].toScalar();
52 else if (key ==
"Colors")
53 colors = MxArrayToVectorVec<double,4>(rhs[i+1]);
54 else if (key ==
"Thickness")
55 thickness = (rhs[i+1].isChar()) ?
57 else if (key ==
"LineType")
58 lineType = (rhs[i+1].isChar()) ?
59 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
60 else if (key ==
"Shift" && !rrect_variant)
61 shift = rhs[i+1].toInt();
64 "Unrecognized option %s", key.
c_str());
70 Point center(rhs[1].toPoint());
71 Size axes(rhs[2].toSize());
72 ellipse(img, center, axes, angle, startAngle, endAngle,
73 color, thickness, lineType, shift);
76 if (rhs[1].numel() == 1) {
78 ellipse(img, box, color, thickness, lineType);
84 for (
size_t i = 0; i < box.
size(); ++i)
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 ellipse(InputOutputArray img, Point center, Size axes, double angle, double startAngle, double endAngle, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
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.