19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
25 vector<MxArray> rhs(prhs, prhs+nrhs);
26 string method(rhs[0].toString());
28 if (method ==
"points") {
30 RotatedRect rect(rhs[1].toRotatedRect());
33 vector<Point2f> v(pt, pt+4);
34 plhs[0] =
MxArray(Mat(v).reshape(1,0));
36 else if (method ==
"boundingRect") {
38 RotatedRect rect(rhs[1].toRotatedRect());
39 Rect r = rect.boundingRect();
42 else if (method ==
"from3points") {
44 Point2f pt1(rhs[1].toPoint2f()),
45 pt2(rhs[2].toPoint2f()),
46 pt3(rhs[3].toPoint2f());
47 plhs[0] =
MxArray(RotatedRect(pt1, pt2, pt3));
50 mexErrMsgIdAndTxt(
"mexopencv:error",
51 "Unrecognized method %s", method.c_str());
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Global constant definitions.