26 string method(rhs[0].toString());
28 if (method ==
"from3points") {
30 if (rhs[1].isNumeric() && rhs[1].numel() == 2 &&
31 rhs[2].isNumeric() && rhs[2].numel() == 2 &&
32 rhs[3].isNumeric() && rhs[3].numel() == 2) {
33 Point2f pt1(rhs[1].toPoint2f()),
34 pt2(rhs[2].toPoint2f()),
35 pt3(rhs[3].toPoint2f());
40 pts2(rhs[2].toVector<Point2f>()),
41 pts3(rhs[3].toVector<Point2f>());
42 if (pts1.size() != pts2.size() || pts1.size() != pts3.
size())
46 for (
size_t i = 0; i < pts1.size(); ++i)
51 else if (method ==
"points") {
54 if (rhs[1].numel() == 1) {
63 for (
size_t i = 0; i < rrects.
size(); ++i) {
64 rrects[i].points(pts);
70 else if (method ==
"boundingRect") {
72 if (rhs[1].numel() == 1) {
81 for (
size_t i = 0; i < rrects.
size(); ++i)
83 plhs[0] =
MxArray(
Mat(vr,
false).reshape(1, 0));
86 else if (method ==
"boundingRect2f") {
88 if (rhs[1].numel() == 1) {
97 for (
size_t i = 0; i < rrects.
size(); ++i)
99 plhs[0] =
MxArray(
Mat(vr,
false).reshape(1, 0));
104 "Unrecognized operation %s", method.
c_str());
Rect boundingRect() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
void points(Point2f pts[]) const
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...
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Global constant definitions.
Buffer clone(Target target=ARRAY_BUFFER, bool autoRelease=false) const
Rect_< float > boundingRect2f() const