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 ==
"SaturationThreshold")
118 "Unrecognized property %s", prop.
c_str());
120 else if (method ==
"set") {
122 string prop(rhs[2].toString());
123 if (prop ==
"SaturationThreshold")
127 "Unrecognized property %s", prop.
c_str());
131 "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
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 float getSaturationThreshold() const=0
virtual void read(const FileNode &fn)
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 last_id
Last object id to allocate.
FileNode getFirstTopLevelNode() const
map< int, Ptr< GrayworldWB > > obj_
Object container.
virtual String getDefaultName() const
virtual void setSaturationThreshold(float val)=0
Global constant definitions.
virtual void save(const String &filename) const
virtual bool empty() const
Ptr< GrayworldWB > createGrayworldWB()
virtual void balanceWhite(InputArray src, OutputArray dst)=0