36 int id = rhs[0].toInt();
37 string method(rhs[1].toString());
40 if (method ==
"new") {
52 if (method ==
"delete") {
57 else if (method ==
"clear") {
61 else if (method ==
"save") {
63 obj->
save(rhs[2].toString());
65 else if (method ==
"load") {
66 nargchk(nrhs>=3 && (nrhs%2)!=0 && nlhs==0);
68 bool loadFromString =
false;
69 for (
int i=3; i<nrhs; i+=2) {
70 string key(rhs[i].toString());
72 objname = rhs[i+1].toString();
73 else if (key ==
"FromString")
74 loadFromString = rhs[i+1].toBool();
77 "Unrecognized option %s", key.
c_str());
86 FileStorage fs(rhs[2].toString(), FileStorage::READ +
87 (loadFromString ? FileStorage::MEMORY : 0));
96 else if (method ==
"empty") {
100 else if (method ==
"getDefaultName") {
104 else if (method ==
"calc") {
105 nargchk(nrhs>=4 && (nrhs%2)==0 && nlhs<=1);
107 for (
int i=4; i<nrhs; i+=2) {
108 string key(rhs[i].toString());
109 if (key ==
"InitialFlow")
110 flow = rhs[i+1].toMat(
CV_32F);
113 "Unrecognized option %s", key.
c_str());
119 obj->
calc(I0, I1, flow);
122 else if (method ==
"calcUV") {
123 nargchk(nrhs>=4 && (nrhs%2)==0 && nlhs<=2);
125 for (
int i=4; i<nrhs; i+=2) {
126 string key(rhs[i].toString());
127 if (key ==
"InitialFlowU")
128 flow_u = rhs[i+1].toMat(
CV_32F);
129 else if (key ==
"InitialFlowV")
130 flow_v = rhs[i+1].toMat(
CV_32F);
133 "Unrecognized option %s", key.
c_str());
140 obj->
calcUV(I0, I1, flow_u, flow_v);
145 else if (method ==
"collectGarbage") {
149 else if (method ==
"get") {
151 string prop(rhs[2].toString());
152 if (prop ==
"FixedPointIterations")
154 else if (prop ==
"SorIterations")
156 else if (prop ==
"Omega")
158 else if (prop ==
"Alpha")
160 else if (prop ==
"Delta")
162 else if (prop ==
"Gamma")
166 "Unrecognized property %s", prop.
c_str());
168 else if (method ==
"set") {
170 string prop(rhs[2].toString());
171 if (prop ==
"FixedPointIterations")
173 else if (prop ==
"SorIterations")
175 else if (prop ==
"Omega")
177 else if (prop ==
"Alpha")
179 else if (prop ==
"Delta")
181 else if (prop ==
"Gamma")
185 "Unrecognized property %s", prop.
c_str());
189 "Unrecognized operation %s", method.
c_str());
virtual int getFixedPointIterations() const=0
virtual void setDelta(float val)=0
virtual void setAlpha(float val)=0
map< int, Ptr< VariationalRefinement > > obj_
Object container.
virtual void collectGarbage()=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual void read(const FileNode &fn)
virtual void setOmega(float val)=0
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...
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
int last_id
Last object id to allocate.
mxArray object wrapper for data conversion and manipulation.
virtual float getAlpha() const=0
void nargchk(bool cond)
Alias for input/output arguments number check.
virtual float getGamma() const=0
FileNode getFirstTopLevelNode() const
virtual void setFixedPointIterations(int val)=0
virtual void calcUV(InputArray I0, InputArray I1, InputOutputArray flow_u, InputOutputArray flow_v)=0
virtual void setGamma(float val)=0
virtual int getSorIterations() const=0
Ptr< VariationalRefinement > createVariationalFlowRefinement()
virtual String getDefaultName() const
Global constant definitions.
void create(int rows, int cols, int type)
virtual float getDelta() const=0
virtual void save(const String &filename) const
virtual bool empty() const
virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow)=0
virtual float getOmega() const=0
virtual void setSorIterations(int val)=0