23 nargchk(nrhs>=1 && (nrhs%2)!=0 && nlhs<=2);
31 bool withDerivatives =
true;
34 bool tryReuseInputImage =
true;
35 for (
int i=1; i<nrhs; i+=2) {
36 string key(rhs[i].toString());
38 winSize = rhs[i+1].toSize();
39 else if (key ==
"MaxLevel")
40 maxLevel = rhs[i+1].toInt();
41 else if (key ==
"WithDerivatives")
42 withDerivatives = rhs[i+1].toBool();
43 else if (key ==
"PyrBorder")
44 pyrBorder = (rhs[i+1].isChar()) ?
45 BorderType[rhs[i+1].toString()] : rhs[i+1].toInt();
46 else if (key ==
"DerivBorder")
47 derivBorder = (rhs[i+1].isChar()) ?
48 BorderType[rhs[i+1].toString()] : rhs[i+1].toInt();
49 else if (key ==
"TryReuseInputImage")
50 tryReuseInputImage = rhs[i+1].toBool();
53 "Unrecognized option %s", key.
c_str());
60 withDerivatives, pyrBorder, derivBorder, tryReuseInputImage);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
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...
const ConstMap< std::string, int > BorderType
Border type map for option processing.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Global constant definitions.
int buildOpticalFlowPyramid(InputArray img, OutputArrayOfArrays pyramid, Size winSize, int maxLevel, bool withDerivatives=true, int pyrBorder=BORDER_REFLECT_101, int derivBorder=BORDER_CONSTANT, bool tryReuseInputImage=true)