19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 bool rrect_variant = rhs[1].isStruct();
29 nargchk(rrect_variant ? ((nrhs%2)==0) : (nrhs>=3 && (nrhs%2)==1));
33 double startAngle = 0;
34 double endAngle = 360;
37 int lineType = cv::LINE_8;
39 for (
int i=(rrect_variant ? 2 : 3); i<nrhs; i+=2) {
40 string key(rhs[i].toString());
41 if (key==
"Angle" && !rrect_variant)
42 angle = rhs[i+1].toDouble();
43 else if (key==
"StartAngle" && !rrect_variant)
44 startAngle = rhs[i+1].toDouble();
45 else if (key==
"EndAngle" && !rrect_variant)
46 endAngle = rhs[i+1].toDouble();
47 else if (key==
"Color")
48 color = rhs[i+1].toScalar();
49 else if (key==
"Thickness")
50 thickness = (rhs[i+1].isChar()) ?
52 else if (key==
"LineType")
53 lineType = (rhs[i+1].isChar()) ?
54 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
55 else if (key==
"Shift" && !rrect_variant)
56 shift = rhs[i+1].toInt();
58 mexErrMsgIdAndTxt(
"mexopencv:error",
59 "Unrecognized option %s", key.c_str());
63 Mat img(rhs[0].toMat());
65 Point center(rhs[1].toPoint());
66 Size axes(rhs[2].toSize());
67 ellipse(img, center, axes, angle, startAngle, endAngle,
68 color, thickness, lineType, shift);
71 RotatedRect box(rhs[1].toRotatedRect());
72 ellipse(img, box, color, thickness, lineType);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
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/ouput arguments number check.
const ConstMap< std::string, int > ThicknessType
Thickness type for drawing.
Global constant definitions.