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());
82 FileStorage fs(rhs[2].toString(), FileStorage::READ +
83 (loadFromString ? FileStorage::MEMORY : 0));
93 else if (method ==
"save") {
95 obj->
save(rhs[2].toString());
97 else if (method ==
"empty") {
101 else if (method ==
"getDefaultName") {
105 else if (method ==
"computeSaliency") {
112 plhs[0] =
MxArray(objectnessBoundingBox);
114 else if (method ==
"getobjectnessValues") {
117 plhs[0] =
MxArray(objectnessValues);
119 else if (method ==
"setTrainingPath") {
121 string trainingPath(rhs[2].toString());
124 else if (method ==
"setBBResDir") {
126 string resultsDir(rhs[2].toString());
129 else if (method ==
"get") {
131 string prop(rhs[2].toString());
134 else if (prop ==
"NSS")
136 else if (prop ==
"W")
140 "Unrecognized property %s", prop.
c_str());
142 else if (method ==
"set") {
144 string prop(rhs[2].toString());
146 obj->
setBase(rhs[3].toDouble());
147 else if (prop ==
"NSS")
148 obj->
setNSS(rhs[3].toInt());
149 else if (prop ==
"W")
150 obj->
setW(rhs[3].toInt());
153 "Unrecognized property %s", prop.
c_str());
157 "Unrecognized operation %s", method.
c_str());
bool computeSaliency(InputArray image, OutputArray saliencyMap)
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
Ptr< Y > staticCast() const
map< int, Ptr< ObjectnessBING > > obj_
Object container.
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
void setTrainingPath(const String &trainingPath)
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...
void setBBResDir(const String &resultsDir)
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
std::vector< float > getobjectnessValues()
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
Global constant definitions.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual void save(const String &filename) const
virtual bool empty() const
int last_id
Last object id to allocate.
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)