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 ==
"load") {
62 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
64 bool loadFromString =
false;
65 for (
int i=3; i<nrhs; i+=2) {
66 string key(rhs[i].toString());
68 objname = rhs[i+1].toString();
69 else if (key ==
"FromString")
70 loadFromString = rhs[i+1].toBool();
73 "Unrecognized option %s", key.
c_str());
75 obj_[id] = (loadFromString ?
76 Algorithm::loadFromString<MotionSaliencyBinWangApr2014>(rhs[2].toString(), objname) :
77 Algorithm::load<MotionSaliencyBinWangApr2014>(rhs[2].toString(), objname));
79 else if (method ==
"save") {
81 obj->
save(rhs[2].toString());
83 else if (method ==
"empty") {
87 else if (method ==
"getDefaultName") {
91 else if (method ==
"computeSaliency") {
100 else if (method ==
"setImagesize") {
102 int W = rhs[2].toInt(),
106 else if (method ==
"init") {
108 bool b = obj->
init();
112 else if (method ==
"get") {
114 string prop(rhs[2].toString());
115 if (prop ==
"ImageWidth")
117 else if (prop ==
"ImageHeight")
121 "Unrecognized property %s", prop.
c_str());
123 else if (method ==
"set") {
125 string prop(rhs[2].toString());
126 if (prop ==
"ImageWidth")
128 else if (prop ==
"ImageHeight")
132 "Unrecognized property %s", prop.
c_str());
136 "Unrecognized operation %s", method.
c_str());
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
map< int, Ptr< MotionSaliencyBinWangApr2014 > > obj_
Object container.
struct mxArray_tag mxArray
Forward declaration for mxArray.
int getImageWidth() const
void setImageWidth(int val)
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.
virtual String getDefaultName() const
Global constant definitions.
void setImagesize(int W, int H)
bool computeSaliency(InputArray image, OutputArray saliencyMap)
int last_id
Last object id to allocate.
virtual void save(const String &filename) const
virtual bool empty() const
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
void setImageHeight(int val)
int getImageHeight() const