36 int id = rhs[0].toInt();
37 string method(rhs[1].toString());
40 if (method ==
"new") {
41 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
43 int num_rotations = 12;
44 for (
int i=2; i<nrhs; i+=2) {
45 string key(rhs[i].toString());
46 if (key ==
"NumBands")
47 num_bands = rhs[i+1].toInt();
48 else if (key ==
"NumRotations")
49 num_rotations = rhs[i+1].toInt();
52 "Unrecognized option %s", key.
c_str());
64 if (method ==
"delete") {
69 else if (method ==
"clear") {
73 else if (method ==
"load") {
74 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
76 bool loadFromString =
false;
77 for (
int i=3; i<nrhs; i+=2) {
78 string key(rhs[i].toString());
80 objname = rhs[i+1].toString();
81 else if (key ==
"FromString")
82 loadFromString = rhs[i+1].toBool();
85 "Unrecognized option %s", key.
c_str());
87 obj_[id] = (loadFromString ?
88 Algorithm::loadFromString<BIF>(rhs[2].toString(), objname) :
89 Algorithm::load<BIF>(rhs[2].toString(), objname));
91 else if (method ==
"save") {
93 obj->
save(rhs[2].toString());
95 else if (method ==
"empty") {
99 else if (method ==
"getDefaultName") {
103 else if (method ==
"compute") {
110 else if (method ==
"get") {
112 string prop(rhs[2].toString());
113 if (prop ==
"NumBands")
115 else if (prop ==
"NumRotations")
119 "Unrecognized property %s", prop.
c_str());
123 "Unrecognized operation %s", method.
c_str());
virtual void compute(InputArray image, OutputArray features) const=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual int getNumRotations() const=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...
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
virtual int getNumBands() const=0
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.
virtual void save(const String &filename) const
virtual bool empty() const
map< int, Ptr< BIF > > obj_
Object container.
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
int last_id
Last object id to allocate.