42 if (
type ==
"Camera") {
43 int deviceId = (len==1) ? first->toInt() : 0;
46 else if (
type ==
"Video") {
48 string fileName(first->toString());
64 "Unrecognized frame source %s",
type.c_str());
67 "Failed to create FrameSource of type %s",
type.c_str());
89 "Failed to create FarnebackOpticalFlow");
90 for (; first != last; first += 2) {
91 string key((*first).toString());
92 const MxArray& val = *(first + 1);
93 if (key ==
"PyrScale")
95 else if (key ==
"LevelsNumber")
97 else if (key ==
"WindowSize")
99 else if (key ==
"Iterations")
101 else if (key ==
"PolyN")
103 else if (key ==
"PolySigma")
105 else if (key ==
"Flags")
109 "Unrecognized option %s", key.c_str());
132 "Failed to create DualTVL1OpticalFlow");
133 for (; first != last; first += 2) {
134 string key((*first).toString());
135 const MxArray& val = *(first + 1);
137 p->
setTau(val.toDouble());
138 else if (key ==
"Lambda")
140 else if (key ==
"Theta")
142 else if (key ==
"ScalesNumber")
144 else if (key ==
"WarpingsNumber")
146 else if (key ==
"Epsilon")
148 else if (key ==
"Iterations")
150 else if (key ==
"UseInitialFlow")
154 "Unrecognized option %s", key.c_str());
175 "Failed to create BroxOpticalFlow");
176 for (; first != last; first += 2) {
177 string key((*first).toString());
178 const MxArray& val = *(first + 1);
181 else if (key ==
"Gamma")
183 else if (key ==
"ScaleFactor")
185 else if (key ==
"InnerIterations")
187 else if (key ==
"OuterIterations")
189 else if (key ==
"SolverIterations")
193 "Unrecognized option %s", key.c_str());
214 "Failed to create PyrLKOpticalFlow");
215 for (; first != last; first += 2) {
216 string key((*first).toString());
217 const MxArray& val = *(first + 1);
218 if (key ==
"WindowSize")
220 else if (key ==
"MaxLevel")
222 else if (key ==
"Iterations")
226 "Unrecognized option %s", key.c_str());
249 if (
type ==
"FarnebackOpticalFlow")
251 else if (
type ==
"DualTVL1OpticalFlow")
253 else if (
type ==
"FarnebackOpticalFlowCUDA")
255 else if (
type ==
"DualTVL1OpticalFlowCUDA")
257 else if (
type ==
"BroxOpticalFlowCUDA")
259 else if (
type ==
"PyrLKOpticalFlowCUDA")
263 "Unrecognized optical flow %s",
type.c_str());
266 "Failed to create DenseOpticalFlowExt of type %s",
type.c_str());
281 else if (
type ==
"BTVL1_CUDA")
285 "Unrecognized super resolution %s",
type.c_str());
288 "Failed to create SuperResolution of type %s",
type.c_str());
300 s.
set(
"TypeId",
string(
typeid(*p).name()));
364 int id = rhs[0].toInt();
365 string method(rhs[1].toString());
368 if (method ==
"new") {
380 if (method ==
"delete") {
385 else if (method ==
"clear") {
389 else if (method ==
"load") {
390 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
392 bool loadFromString =
false;
393 for (
int i=3; i<nrhs; i+=2) {
394 string key(rhs[i].toString());
395 if (key ==
"ObjName")
396 objname = rhs[i+1].toString();
397 else if (key ==
"FromString")
398 loadFromString = rhs[i+1].toBool();
401 "Unrecognized option %s", key.
c_str());
410 FileStorage fs(rhs[2].toString(), FileStorage::READ +
411 (loadFromString ? FileStorage::MEMORY : 0));
420 else if (method ==
"save") {
422 obj->
save(rhs[2].toString());
424 else if (method ==
"empty") {
428 else if (method ==
"getDefaultName") {
432 else if (method ==
"collectGarbage") {
436 else if (method ==
"nextFrame") {
437 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
439 for (
int i=2; i<nrhs; i+=2) {
440 string key(rhs[i].toString());
441 if (key ==
"FlipChannels")
442 flip = rhs[i+1].toBool();
445 "Unrecognized option %s", key.
c_str());
456 else if (method ==
"reset") {
460 else if (method ==
"setInput") {
463 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
466 else if (method ==
"setOpticalFlow") {
469 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
472 else if (method ==
"getOpticalFlow") {
477 else if (method ==
"get") {
479 string prop(rhs[2].toString());
482 else if (prop ==
"BlurKernelSize")
484 else if (prop ==
"BlurSigma")
486 else if (prop ==
"Iterations")
488 else if (prop ==
"KernelSize")
490 else if (prop ==
"Labmda")
492 else if (prop ==
"Scale")
494 else if (prop ==
"Tau")
496 else if (prop ==
"TemporalAreaRadius")
500 "Unrecognized property %s", prop.
c_str());
502 else if (method ==
"set") {
504 string prop(rhs[2].toString());
507 else if (prop ==
"BlurKernelSize")
509 else if (prop ==
"BlurSigma")
511 else if (prop ==
"Iterations")
513 else if (prop ==
"KernelSize")
515 else if (prop ==
"Labmda")
517 else if (prop ==
"Scale")
519 else if (prop ==
"Tau")
520 obj->
setTau(rhs[3].toDouble());
521 else if (prop ==
"TemporalAreaRadius")
525 "Unrecognized property %s", prop.
c_str());
529 "Unrecognized operation %s", method.
c_str());
virtual double getTheta() const=0
virtual int getScale() const=0
virtual void setPolyN(int val)=0
virtual int getMaxLevel() const=0
void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0)
Ptr< FrameSource > createFrameSource(const string &type, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of FrameSource using options in arguments.
virtual int getFlags() const=0
virtual Ptr< cv::superres::DenseOpticalFlowExt > getOpticalFlow() const=0
Ptr< PyrLKOpticalFlow > createPyrLKOpticalFlow(bool, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of PyrLKOpticalFlow using options in arguments.
virtual void setWarpingsNumber(int val)=0
virtual void setFlags(int val)=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
Ptr< SuperResolution > createSuperResolution(const string &type)
Create an instance of SuperResolution using options in arguments.
virtual void setScale(int val)=0
virtual void setTau(double val)=0
virtual void setScalesNumber(int val)=0
virtual void setWindowSize(int val)=0
virtual void setOuterIterations(int val)=0
virtual void setPyrScale(double val)=0
virtual void setAlpha(double val)=0
virtual void setLabmda(double val)=0
Ptr< FrameSource > createFrameSource_Video(const String &fileName)
Ptr< DualTVL1OpticalFlow > createOptFlow_DualTVL1_CUDA()
virtual double getScaleFactor() const=0
virtual int getKernelSize() const=0
virtual int getWindowSize() const=0
virtual bool isOpened() const
Ptr< superres::DualTVL1OpticalFlow > createDualTVL1OpticalFlow(bool use_gpu, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of DualTVL1OpticalFlow using options in arguments.
virtual int getIterations() const=0
virtual double getTau() const=0
virtual void collectGarbage()
struct mxArray_tag mxArray
Forward declaration for mxArray.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
virtual int getIterations() const=0
virtual int getIterations() const=0
void nextFrame(OutputArray frame)
Ptr< SuperResolution > createSuperResolution_BTVL1_CUDA()
virtual void setScaleFactor(double val)=0
virtual bool getUseInitialFlow() const=0
virtual int getLevelsNumber() const=0
virtual int getOuterIterations() const=0
virtual double getTau() const=0
virtual int getTemporalAreaRadius() const=0
virtual int getWindowSize() const=0
virtual void setPolySigma(double val)=0
virtual void setSolverIterations(int val)=0
virtual void read(const FileNode &fn)
Ptr< FarnebackOpticalFlow > createOptFlow_Farneback()
Ptr< Y > dynamicCast() const
map< int, Ptr< SuperResolution > > obj_
Object container.
virtual void setOpticalFlow(const Ptr< cv::superres::DenseOpticalFlowExt > &val)=0
Ptr< DenseOpticalFlowExt > createDenseOpticalFlowExt(const string &type, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of DenseOpticalFlowExt using options in arguments.
virtual void setTau(double 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...
virtual double getLabmda() const=0
virtual int getSolverIterations() const=0
virtual void setLevelsNumber(int val)=0
virtual void setIterations(int val)=0
virtual int getBlurKernelSize() const=0
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
virtual double getLambda() const=0
Ptr< BroxOpticalFlow > createOptFlow_Brox_CUDA()
virtual double getPyrScale() const=0
virtual void setAlpha(double val)=0
virtual void setBlurKernelSize(int val)=0
virtual double getAlpha() const=0
virtual int getScalesNumber() const=0
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
void setInput(const Ptr< FrameSource > &frameSource)
static MxArray Struct(const char **fields=NULL, int nfields=0, mwSize m=1, mwSize n=1)
Create a new struct array.
FileNode getFirstTopLevelNode() const
Ptr< BroxOpticalFlow > createBroxOpticalFlow(bool, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of BroxOpticalFlow using options in arguments.
virtual int getIterations() const=0
virtual double getGamma() const=0
virtual void setGamma(double val)=0
MxArray toStruct(Ptr< DenseOpticalFlowExt > p)
Convert a DenseOpticalFlowExt to MxArray.
virtual String getDefaultName() const
virtual void setInnerIterations(int val)=0
Ptr< FarnebackOpticalFlow > createOptFlow_Farneback_CUDA()
Global constant definitions.
virtual void setIterations(int val)=0
virtual int getPolyN() const=0
virtual double getBlurSigma() const=0
virtual double getAlpha() const=0
virtual void setTheta(double val)=0
virtual double getEpsilon() const=0
virtual void setKernelSize(int val)=0
Ptr< SuperResolution > createSuperResolution_BTVL1()
virtual int getInnerIterations() const=0
virtual void setWindowSize(int val)=0
virtual void setUseInitialFlow(bool val)=0
virtual double getPolySigma() const=0
virtual void setBlurSigma(double val)=0
virtual void setTemporalAreaRadius(int val)=0
Ptr< PyrLKOpticalFlow > createOptFlow_PyrLK_CUDA()
virtual int getWarpingsNumber() const=0
void flip(InputArray src, OutputArray dst, int flipCode)
virtual void save(const String &filename) const
virtual bool empty() const
virtual void setLambda(double val)=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual void setMaxLevel(int val)=0
virtual void setIterations(int val)=0
virtual void setEpsilon(double val)=0
Ptr< FrameSource > createFrameSource_Camera(int deviceId=0)
Ptr< DualTVL1OpticalFlow > createOptFlow_DualTVL1()
Ptr< superres::FarnebackOpticalFlow > createFarnebackOpticalFlow(bool use_gpu, vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of FarnebackOpticalFlow using options in arguments.
int last_id
Last object id to allocate.
virtual void setIterations(int val)=0