17 (
"Cross", cv::MARKER_CROSS)
18 (
"+", cv::MARKER_CROSS)
19 (
"TiltedCross", cv::MARKER_TILTED_CROSS)
20 (
"x", cv::MARKER_TILTED_CROSS)
21 (
"Star", cv::MARKER_STAR)
22 (
"*", cv::MARKER_STAR)
23 (
"Diamond", cv::MARKER_DIAMOND)
24 (
"d", cv::MARKER_DIAMOND)
25 (
"Square", cv::MARKER_SQUARE)
26 (
"s", cv::MARKER_SQUARE)
27 (
"TriangleUp", cv::MARKER_TRIANGLE_UP)
28 (
"^", cv::MARKER_TRIANGLE_UP)
29 (
"TriangleDown", cv::MARKER_TRIANGLE_DOWN)
30 (
"v", cv::MARKER_TRIANGLE_DOWN);
40 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
43 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
46 vector<MxArray> rhs(prhs, prhs+nrhs);
50 int markerType = cv::MARKER_CROSS;
53 int line_type = cv::LINE_8;
54 for (
int i=2; i<nrhs; i+=2) {
55 string key(rhs[i].toString());
57 color = rhs[i+1].toScalar();
58 else if (key ==
"MarkerType")
59 markerType = (rhs[i+1].isChar()) ?
60 MarkerTypeMap[rhs[i+1].toString()] : rhs[i+1].toInt();
61 else if (key ==
"MarkerSize")
62 markerSize = rhs[i+1].toInt();
63 else if (key ==
"Thickness")
64 thickness = (rhs[i+1].isChar()) ?
66 else if (key ==
"LineType")
67 line_type = (rhs[i+1].isChar()) ?
68 LineType[rhs[i+1].toString()] : rhs[i+1].toInt();
70 mexErrMsgIdAndTxt(
"mexopencv:error",
71 "Unrecognized option %s", key.c_str());
75 Mat img(rhs[0].toMat());
76 Point position(rhs[1].toPoint());
77 drawMarker(img, position, color, markerType, markerSize, thickness,
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.
std::map wrapper with one-line initialization and lookup method.