19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
22 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
25 vector<MxArray> rhs(prhs, prhs+nrhs);
31 int lineType = cv::LINE_8;
33 for (
int i=2; i<nrhs; i+=2) {
34 string key(rhs[i].toString());
36 color = rhs[i+1].toScalar();
37 else if (key==
"Thickness")
38 thickness = (rhs[i+1].isChar()) ?
40 else if (key==
"LineType")
41 lineType = (rhs[i+1].isChar()) ?
42 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
43 else if (key==
"Shift")
44 shift = rhs[i+1].toInt();
45 else if (key==
"Closed")
46 isClosed = rhs[i+1].toBool();
48 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
52 Mat img(rhs[0].toMat());
53 vector<vector<Point> > pts(MxArrayToVectorVectorPoint<int>(rhs[1]));
54 polylines(img, pts, isClosed, color, thickness, lineType, shift);
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.