42 int id = rhs[0].toInt();
43 string method(rhs[1].toString());
46 if (method ==
"new") {
47 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
49 for (
int i=2; i<nrhs; i+=2) {
50 string key(rhs[i].toString());
55 "Unrecognized option %s", key.
c_str());
67 if (method ==
"delete") {
72 else if (method ==
"clear") {
76 else if (method ==
"save") {
78 obj->
save(rhs[2].toString());
80 else if (method ==
"load") {
81 nargchk(nrhs>=3 && (nrhs%2)!=0 && nlhs==0);
83 bool loadFromString =
false;
84 for (
int i=3; i<nrhs; i+=2) {
85 string key(rhs[i].toString());
87 objname = rhs[i+1].toString();
88 else if (key ==
"FromString")
89 loadFromString = rhs[i+1].toBool();
92 "Unrecognized option %s", key.
c_str());
101 FileStorage fs(rhs[2].toString(), FileStorage::READ +
102 (loadFromString ? FileStorage::MEMORY : 0));
111 else if (method ==
"empty") {
115 else if (method ==
"getDefaultName") {
119 else if (method ==
"calc") {
120 nargchk(nrhs>=4 && (nrhs%2)==0 && nlhs<=1);
122 for (
int i=4; i<nrhs; i+=2) {
123 string key(rhs[i].toString());
124 if (key ==
"InitialFlow")
125 flow = rhs[i+1].toMat(
CV_32F);
128 "Unrecognized option %s", key.
c_str());
132 obj->
calc(I0, I1, flow);
135 else if (method ==
"collectGarbage") {
139 else if (method ==
"get") {
141 string prop(rhs[2].toString());
142 if (prop ==
"FinestScale")
144 else if (prop ==
"PatchSize")
146 else if (prop ==
"PatchStride")
148 else if (prop ==
"GradientDescentIterations")
150 else if (prop ==
"VariationalRefinementIterations")
152 else if (prop ==
"VariationalRefinementAlpha")
154 else if (prop ==
"VariationalRefinementDelta")
156 else if (prop ==
"VariationalRefinementGamma")
158 else if (prop ==
"UseMeanNormalization")
160 else if (prop ==
"UseSpatialPropagation")
164 "Unrecognized property %s", prop.
c_str());
166 else if (method ==
"set") {
168 string prop(rhs[2].toString());
169 if (prop ==
"FinestScale")
171 else if (prop ==
"PatchSize")
173 else if (prop ==
"PatchStride")
175 else if (prop ==
"GradientDescentIterations")
177 else if (prop ==
"VariationalRefinementIterations")
179 else if (prop ==
"VariationalRefinementAlpha")
181 else if (prop ==
"VariationalRefinementDelta")
183 else if (prop ==
"VariationalRefinementGamma")
185 else if (prop ==
"UseMeanNormalization")
187 else if (prop ==
"UseSpatialPropagation")
191 "Unrecognized property %s", prop.
c_str());
195 "Unrecognized operation %s", method.
c_str());
virtual void setUseSpatialPropagation(bool val)=0
virtual void setVariationalRefinementDelta(float val)=0
virtual void collectGarbage()=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
int last_id
Last object id to allocate.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual bool getUseSpatialPropagation() const=0
virtual float getVariationalRefinementDelta() const=0
virtual bool isOpened() const
virtual int getPatchStride() const=0
Ptr< DISOpticalFlow > createOptFlow_DIS(int preset=DISOpticalFlow::PRESET_FAST)
virtual void setPatchSize(int val)=0
virtual int getVariationalRefinementIterations() const=0
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual bool getUseMeanNormalization() const=0
virtual int getFinestScale() const=0
virtual void setUseMeanNormalization(bool val)=0
virtual void setPatchStride(int val)=0
virtual void setFinestScale(int val)=0
virtual void setVariationalRefinementAlpha(float val)=0
virtual void read(const FileNode &fn)
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.
virtual float getVariationalRefinementGamma() const=0
virtual float getVariationalRefinementAlpha() const=0
virtual void setVariationalRefinementIterations(int val)=0
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
FileNode getFirstTopLevelNode() const
virtual String getDefaultName() const
Global constant definitions.
virtual int getGradientDescentIterations() const=0
virtual int getPatchSize() const=0
virtual void setGradientDescentIterations(int val)=0
map< int, Ptr< DISOpticalFlow > > obj_
Object container.
virtual void save(const String &filename) const
virtual bool empty() const
virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow)=0
std::map wrapper with one-line initialization and lookup method.
virtual void setVariationalRefinementGamma(float val)=0
const ConstMap< string, int > DISPresetMap
DIS preset types.