23 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
34 for (
int i=3; i<nrhs; i+=2) {
35 string key(rhs[i].toString());
37 color = (rhs[i+1].isChar()) ?
38 ColorType[rhs[i+1].toString()] : rhs[i+1].toScalar();
39 else if (key ==
"Colors")
40 colors = MxArrayToVectorVec<double,4>(rhs[i+1]);
41 else if (key ==
"Thickness")
42 thickness = (rhs[i+1].isChar()) ?
44 else if (key ==
"LineType")
45 lineType = (rhs[i+1].isChar()) ?
46 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
47 else if (key ==
"Shift")
48 shift = rhs[i+1].toInt();
51 "Unrecognized option %s", key.
c_str());
56 if (rhs[1].isNumeric() && rhs[1].numel() == 2) {
57 Point pt1(rhs[1].toPoint()),
58 pt2(rhs[2].toPoint());
59 line(img, pt1, pt2, color, thickness, lineType, shift);
63 pt2(rhs[2].toVector<Point>());
64 if (pt1.size() != pt2.
size())
66 if (!colors.
empty() && colors.
size() != pt1.size())
68 for (
size_t i = 0; i < pt1.size(); ++i)
69 line(img, pt1[i], pt2[i],
71 thickness, lineType, shift);
struct mxArray_tag mxArray
Forward declaration for mxArray.
void line(InputOutputArray img, Point pt1, Point pt2, 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.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
const ConstMap< std::string, cv::Scalar > ColorType
Translates MATLAB color names (see ColorSpec) into OpenCV scalars.