35 int id = rhs[0].toInt();
36 string method(rhs[1].toString());
39 if (method ==
"new") {
51 if (method ==
"delete") {
56 else if (method ==
"clear") {
60 else if (method ==
"save") {
62 obj->
save(rhs[2].toString());
64 else if (method ==
"load") {
65 nargchk(nrhs>=3 && (nrhs%2)!=0 && nlhs==0);
67 bool loadFromString =
false;
68 for (
int i=3; i<nrhs; i+=2) {
69 string key(rhs[i].toString());
71 objname = rhs[i+1].toString();
72 else if (key ==
"FromString")
73 loadFromString = rhs[i+1].toBool();
76 "Unrecognized option %s", key.
c_str());
85 FileStorage fs(rhs[2].toString(), FileStorage::READ +
86 (loadFromString ? FileStorage::MEMORY : 0));
95 else if (method ==
"empty") {
99 else if (method ==
"getDefaultName") {
103 else if (method ==
"calc") {
104 nargchk(nrhs>=4 && (nrhs%2)==0 && nlhs<=1);
106 for (
int i=4; i<nrhs; i+=2) {
107 string key(rhs[i].toString());
108 if (key ==
"InitialFlow")
109 flow = rhs[i+1].toMat(
CV_32F);
112 "Unrecognized option %s", key.
c_str());
116 obj->
calc(I0, I1, flow);
119 else if (method ==
"collectGarbage") {
123 else if (method ==
"get") {
125 string prop(rhs[2].toString());
126 if (prop ==
"Epsilon")
128 else if (prop ==
"Gamma")
130 else if (prop ==
"InnerIterations")
132 else if (prop ==
"Lambda")
134 else if (prop ==
"MedianFiltering")
136 else if (prop ==
"OuterIterations")
138 else if (prop ==
"ScalesNumber")
140 else if (prop ==
"ScaleStep")
142 else if (prop ==
"Tau")
144 else if (prop ==
"Theta")
146 else if (prop ==
"UseInitialFlow")
148 else if (prop ==
"WarpingsNumber")
152 "Unrecognized property %s", prop.
c_str());
154 else if (method ==
"set") {
156 string prop(rhs[2].toString());
157 if (prop ==
"Epsilon")
159 else if (prop ==
"Gamma")
161 else if (prop ==
"InnerIterations")
163 else if (prop ==
"Lambda")
165 else if (prop ==
"MedianFiltering")
167 else if (prop ==
"OuterIterations")
169 else if (prop ==
"ScalesNumber")
171 else if (prop ==
"ScaleStep")
173 else if (prop ==
"Tau")
174 obj->
setTau(rhs[3].toDouble());
175 else if (prop ==
"Theta")
177 else if (prop ==
"UseInitialFlow")
179 else if (prop ==
"WarpingsNumber")
183 "Unrecognized property %s", prop.
c_str());
187 "Unrecognized operation %s", method.
c_str());
virtual double getGamma() const=0
virtual bool getUseInitialFlow() const=0
virtual void setEpsilon(double 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.
virtual int getWarpingsNumber() const=0
virtual void setGamma(double val)=0
virtual void setInnerIterations(int val)=0
virtual void setOuterIterations(int val)=0
virtual double getScaleStep() const=0
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual int getInnerIterations() const=0
virtual double getLambda() const=0
virtual void setMedianFiltering(int val)=0
virtual int getMedianFiltering() const=0
virtual void setUseInitialFlow(bool val)=0
virtual int getScalesNumber() const=0
virtual void read(const FileNode &fn)
virtual void setScalesNumber(int 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...
map< int, Ptr< DualTVL1OpticalFlow > > obj_
Object container.
virtual void setWarpingsNumber(int val)=0
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
virtual double getEpsilon() const=0
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
virtual double getTau() const=0
int last_id
Last object id to allocate.
FileNode getFirstTopLevelNode() const
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual void setTau(double val)=0
virtual String getDefaultName() const
Global constant definitions.
virtual void setTheta(double val)=0
virtual void setLambda(double val)=0
virtual void save(const String &filename) const
virtual bool empty() const
virtual void calc(InputArray I0, InputArray I1, InputOutputArray flow)=0
virtual int getOuterIterations() const=0
virtual double getTheta() const=0
virtual void setScaleStep(double val)=0
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)