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 ==
"save") {
63 obj->
save(rhs[2].toString());
65 else if (method ==
"load") {
66 nargchk(nrhs>=3 && (nrhs%2)!=0 && nlhs==0);
68 bool loadFromString =
false;
69 for (
int i=3; i<nrhs; i+=2) {
70 string key(rhs[i].toString());
72 objname = rhs[i+1].toString();
73 else if (key ==
"FromString")
74 loadFromString = rhs[i+1].toBool();
77 "Unrecognized option %s", key.
c_str());
86 FileStorage fs(rhs[2].toString(), FileStorage::READ +
87 (loadFromString ? FileStorage::MEMORY : 0));
96 else if (method ==
"empty") {
100 else if (method ==
"getDefaultName") {
104 else if (method ==
"balanceWhite") {
111 else if (method ==
"get") {
113 string prop(rhs[2].toString());
114 if (prop ==
"InputMin")
116 else if (prop ==
"InputMax")
118 else if (prop ==
"OutputMin")
120 else if (prop ==
"OutputMax")
122 else if (prop ==
"P")
126 "Unrecognized property %s", prop.
c_str());
128 else if (method ==
"set") {
130 string prop(rhs[2].toString());
131 if (prop ==
"InputMin")
133 else if (prop ==
"InputMax")
135 else if (prop ==
"OutputMin")
137 else if (prop ==
"OutputMax")
139 else if (prop ==
"P")
140 obj->
setP(rhs[3].toFloat());
143 "Unrecognized property %s", prop.
c_str());
147 "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.
virtual bool isOpened() const
virtual float getInputMin() const=0
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual float getP() const=0
virtual void setOutputMax(float val)=0
virtual void read(const FileNode &fn)
virtual float getInputMax() const=0
int last_id
Last object id to allocate.
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...
virtual float getOutputMax() const=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
Ptr< SimpleWB > createSimpleWB()
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
FileNode getFirstTopLevelNode() const
virtual void setP(float val)=0
virtual void setInputMin(float val)=0
virtual String getDefaultName() const
virtual float getOutputMin() const=0
Global constant definitions.
virtual void setInputMax(float val)=0
virtual void setOutputMin(float val)=0
virtual void save(const String &filename) const
virtual bool empty() const
virtual void balanceWhite(InputArray src, OutputArray dst)=0
map< int, Ptr< SimpleWB > > obj_
Object container.