19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
22 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 int fontFace = cv::FONT_HERSHEY_SIMPLEX;
30 double fontScale = 1.0;
33 int lineType = cv::LINE_8;
34 bool bottomLeftOrigin =
false;
35 for (
int i=3; i<nrhs; i+=2) {
36 string key(rhs[i].toString());
38 fontFace =
FontFace[rhs[i+1].toString()];
39 else if (key==
"FontStyle")
40 fontStyle =
FontStyle[rhs[i+1].toString()];
41 else if (key==
"FontScale")
42 fontScale = rhs[i+1].toDouble();
43 else if (key==
"Color")
44 color = rhs[i+1].toScalar();
45 else if (key==
"Thickness")
46 thickness = (rhs[i+1].isChar()) ?
48 else if (key==
"LineType")
49 lineType = (rhs[i+1].isChar()) ?
50 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
51 else if (key==
"BottomLeftOrigin")
52 bottomLeftOrigin = rhs[i+1].toBool();
54 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
56 fontFace |= fontStyle;
59 Mat img(rhs[0].toMat());
60 string text(rhs[1].toString());
61 Point org(rhs[2].toPoint());
62 putText(img, text, org, fontFace, fontScale, color, thickness,
63 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.
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.
const ConstMap< std::string, int > FontFace
Font faces for drawing.