23 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
34 double tipLength = 0.1;
35 for (
int i=3; i<nrhs; i+=2) {
36 string key(rhs[i].toString());
38 color = (rhs[i+1].isChar()) ?
39 ColorType[rhs[i+1].toString()] : rhs[i+1].toScalar();
40 else if (key ==
"Colors")
41 colors = MxArrayToVectorVec<double,4>(rhs[i+1]);
42 else if (key ==
"Thickness")
43 thickness = (rhs[i+1].isChar()) ?
45 else if (key ==
"LineType")
46 lineType = (rhs[i+1].isChar()) ?
47 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
48 else if (key ==
"Shift")
49 shift = rhs[i+1].toInt();
50 else if (key ==
"TipLength")
51 tipLength = rhs[i+1].toDouble();
54 "Unrecognized option %s", key.
c_str());
59 if (rhs[1].isNumeric() && rhs[1].numel() == 2) {
60 Point pt1(rhs[1].toPoint()),
61 pt2(rhs[2].toPoint());
62 arrowedLine(img, pt1, pt2, color, thickness, lineType, shift, tipLength);
66 pt2(rhs[2].toVector<Point>());
67 if (pt1.size() != pt2.
size())
69 if (!colors.
empty() && colors.
size() != pt1.size())
71 for (
size_t i = 0; i < pt1.size(); ++i)
74 thickness, lineType, shift, tipLength);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
struct mxArray_tag mxArray
Forward declaration for mxArray.
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...
void arrowedLine(InputOutputArray img, Point pt1, Point pt2, const Scalar &color, int thickness=1, int line_type=8, int shift=0, double tipLength=0.1)
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.