23 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=4);
33 bool fixedRange =
false;
34 bool maskOnly =
false;
36 for (
int i=3; i<nrhs; i+=2) {
37 string key(rhs[i].toString());
39 mask = rhs[i+1].toMat(
CV_8U);
40 else if (key ==
"LoDiff")
41 loDiff = rhs[i+1].toScalar();
42 else if (key ==
"UpDiff")
43 upDiff = rhs[i+1].toScalar();
44 else if (key ==
"Connectivity")
45 connectivity = rhs[i+1].toInt();
46 else if (key ==
"FixedRange")
47 fixedRange = rhs[i+1].toBool();
48 else if (key ==
"MaskOnly")
49 maskOnly = rhs[i+1].toBool();
50 else if (key ==
"MaskFillValue")
51 maskVal = rhs[i+1].toInt();
54 "Unrecognized option %s", key.
c_str());
56 if (connectivity!=4 && connectivity!=8)
58 if (maskVal<0 || maskVal>255)
60 maskVal = (maskVal==0 && maskOnly) ? 1 : maskVal;
61 int flags = connectivity |
69 Point seed(rhs[1].toPoint());
70 Scalar newVal(rhs[2].toScalar());
74 area =
floodFill(img, mask, seed, newVal, (nlhs>1 ? &rect : NULL),
75 loDiff, upDiff, flags);
77 area =
floodFill(img, seed, newVal, (nlhs>1 ? &rect : NULL),
78 loDiff, upDiff, flags);
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...
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Global constant definitions.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
int floodFill(InputOutputArray image, Point seedPoint, Scalar newVal, Rect *rect=0, Scalar loDiff=Scalar(), Scalar upDiff=Scalar(), int flags=4)