36 int id = rhs[0].toInt();
37 string method(rhs[1].toString());
40 if (method ==
"new") {
41 nargchk(nrhs>=4 && (nrhs%2)==0 && nlhs<=1);
42 double amplitude = 2.0;
43 double wavelength = 20.0;
44 double wavespeed = 0.2;
45 double objspeed = 6.0;
46 for (
int i=4; i<nrhs; i+=2) {
47 string key(rhs[i].toString());
48 if (key ==
"Amplitude")
49 amplitude = rhs[i+1].toDouble();
50 else if (key ==
"WaveLength")
51 wavelength = rhs[i+1].toDouble();
52 else if (key ==
"WaveSpeed")
53 wavespeed = rhs[i+1].toDouble();
54 else if (key ==
"ObjSpeed")
55 objspeed = rhs[i+1].toDouble();
58 "Unrecognized option %s", key.
c_str());
63 amplitude, wavelength, wavespeed, objspeed);
73 if (method ==
"delete") {
78 else if (method ==
"clear") {
82 else if (method ==
"load") {
83 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
85 bool loadFromString =
false;
86 for (
int i=3; i<nrhs; i+=2) {
87 string key(rhs[i].toString());
89 objname = rhs[i+1].toString();
90 else if (key ==
"FromString")
91 loadFromString = rhs[i+1].toBool();
94 "Unrecognized option %s", key.
c_str());
103 FileStorage fs(rhs[2].toString(), FileStorage::READ +
104 (loadFromString ? FileStorage::MEMORY : 0));
113 else if (method ==
"save") {
115 obj->
save(rhs[2].toString());
117 else if (method ==
"empty") {
121 else if (method ==
"getDefaultName") {
125 else if (method ==
"getNextFrame") {
135 "Unrecognized operation %s", method.
c_str());
int last_id
Last object id to allocate.
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.
Ptr< SyntheticSequenceGenerator > createSyntheticSequenceGenerator(InputArray background, InputArray object, double amplitude=2.0, double wavelength=20.0, double wavespeed=0.2, double objspeed=6.0)
void getNextFrame(OutputArray frame, OutputArray gtMask)
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.
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
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Global constant definitions.
virtual void save(const String &filename) const
virtual bool empty() const
map< int, Ptr< SyntheticSequenceGenerator > > obj_
Object container.