23 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
30 double pyrScale = 0.5;
35 double polySigma = 1.1;
37 for (
int i=2; i<nrhs; i+=2) {
38 string key(rhs[i].toString());
39 if (key ==
"InitialFlow") {
40 flow = rhs[i+1].toMat(
CV_32F);
43 else if (key ==
"PyrScale")
44 pyrScale = rhs[i+1].toDouble();
45 else if (key ==
"Levels")
46 levels = rhs[i+1].toInt();
47 else if (key ==
"WinSize")
48 winsize = rhs[i+1].toInt();
49 else if (key ==
"Iterations")
50 iterations = rhs[i+1].toInt();
51 else if (key ==
"PolyN")
52 polyN = rhs[i+1].toInt();
53 else if (key ==
"PolySigma")
54 polySigma = rhs[i+1].toDouble();
55 else if (key ==
"Gaussian")
59 "Unrecognized option %s", key.
c_str());
66 winsize, iterations, polyN, polySigma, flags);
struct mxArray_tag mxArray
Forward declaration for mxArray.
void calcOpticalFlowFarneback(InputArray prev, InputArray next, InputOutputArray flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags)
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
#define UPDATE_FLAG(NUM, TF, BIT)
set or clear a bit in flag depending on bool value
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.
OPTFLOW_FARNEBACK_GAUSSIAN