23 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
31 double fontScale = 1.0;
36 bool bottomLeftOrigin =
false;
37 for (
int i=3; i<nrhs; i+=2) {
38 string key(rhs[i].toString());
39 if (key ==
"FontFace")
40 fontFace =
FontFace[rhs[i+1].toString()];
41 else if (key ==
"FontStyle")
42 fontStyle =
FontStyle[rhs[i+1].toString()];
43 else if (key ==
"FontScale")
44 fontScale = rhs[i+1].toDouble();
45 else if (key ==
"Color")
46 color = (rhs[i+1].isChar()) ?
47 ColorType[rhs[i+1].toString()] : rhs[i+1].toScalar();
48 else if (key ==
"Colors")
49 colors = MxArrayToVectorVec<double,4>(rhs[i+1]);
50 else if (key ==
"Thickness")
51 thickness = (rhs[i+1].isChar()) ?
53 else if (key ==
"LineType")
54 lineType = (rhs[i+1].isChar()) ?
55 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
56 else if (key ==
"BottomLeftOrigin")
57 bottomLeftOrigin = rhs[i+1].toBool();
60 "Unrecognized option %s", key.
c_str());
62 fontFace |= fontStyle;
66 if (rhs[1].isChar()) {
67 string text(rhs[1].toString());
68 Point org(rhs[2].toPoint());
69 putText(img, text, org, fontFace, fontScale, color, thickness,
70 lineType, bottomLeftOrigin);
79 for (
size_t i = 0; i < text.
size(); ++i)
80 putText(img, text[i], org[i], fontFace, fontScale,
82 thickness, lineType, bottomLeftOrigin);
const ConstMap< std::string, int > FontStyle
Font styles for drawing.
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...
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 putText(InputOutputArray img, const String &text, Point org, int fontFace, double fontScale, Scalar color, int thickness=1, int lineType=LINE_8, bool bottomLeftOrigin=false)
const ConstMap< std::string, cv::Scalar > ColorType
Translates MATLAB color names (see ColorSpec) into OpenCV scalars.
const ConstMap< std::string, int > FontFace
Font faces for drawing.