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<StaticSaliencySpectralResidual>(rhs[2].toString(), objname) :
77 Algorithm::load<StaticSaliencySpectralResidual>(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 ==
"computeBinaryMap") {
109 else if (method ==
"get") {
111 string prop(rhs[2].toString());
112 if (prop ==
"ImageWidth")
114 else if (prop ==
"ImageHeight")
118 "Unrecognized property %s", prop.
c_str());
120 else if (method ==
"set") {
122 string prop(rhs[2].toString());
123 if (prop ==
"ImageWidth")
125 else if (prop ==
"ImageHeight")
129 "Unrecognized property %s", prop.
c_str());
133 "Unrecognized operation %s", method.
c_str());
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.
struct mxArray_tag mxArray
Forward declaration for mxArray.
int getImageHeight() const
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
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.
int getImageWidth() const
bool computeSaliency(InputArray image, OutputArray saliencyMap)
bool computeBinaryMap(InputArray _saliencyMap, OutputArray _binaryMap)
virtual String getDefaultName() const
Global constant definitions.
void setImageWidth(int val)
virtual void save(const String &filename) const
virtual bool empty() const
void setImageHeight(int val)
map< int, Ptr< StaticSaliencySpectralResidual > > obj_
Object container.
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)