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 for (
int i=2; i<nrhs; i+=2) {
44 string key(rhs[i].toString());
45 if (key ==
"PathToModel")
46 path_to_model = rhs[i+1].toString();
49 "Unrecognized option %s", key.
c_str());
61 if (method ==
"delete") {
66 else if (method ==
"clear") {
70 else if (method ==
"save") {
72 obj->
save(rhs[2].toString());
74 else if (method ==
"load") {
75 nargchk(nrhs>=3 && (nrhs%2)!=0 && nlhs==0);
77 bool loadFromString =
false;
78 for (
int i=3; i<nrhs; i+=2) {
79 string key(rhs[i].toString());
81 objname = rhs[i+1].toString();
82 else if (key ==
"FromString")
83 loadFromString = rhs[i+1].toBool();
86 "Unrecognized option %s", key.
c_str());
95 FileStorage fs(rhs[2].toString(), FileStorage::READ +
96 (loadFromString ? FileStorage::MEMORY : 0));
105 else if (method ==
"empty") {
109 else if (method ==
"getDefaultName") {
113 else if (method ==
"balanceWhite") {
120 else if (method ==
"extractSimpleFeatures") {
127 else if (method ==
"get") {
129 string prop(rhs[2].toString());
130 if (prop ==
"RangeMaxVal")
132 else if (prop ==
"SaturationThreshold")
134 else if (prop ==
"HistBinNum")
138 "Unrecognized property %s", prop.
c_str());
140 else if (method ==
"set") {
142 string prop(rhs[2].toString());
143 if (prop ==
"RangeMaxVal")
145 else if (prop ==
"SaturationThreshold")
147 else if (prop ==
"HistBinNum")
151 "Unrecognized property %s", prop.
c_str());
155 "Unrecognized operation %s", method.
c_str());
virtual void setSaturationThreshold(float val)=0
virtual float getSaturationThreshold() const=0
virtual void setRangeMaxVal(int val)=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual int getHistBinNum() const=0
map< int, Ptr< LearningBasedWB > > obj_
Object container.
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual void setHistBinNum(int val)=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...
virtual int getRangeMaxVal() 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.
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.
virtual void extractSimpleFeatures(InputArray src, OutputArray dst)=0
virtual void save(const String &filename) const
virtual bool empty() const
Ptr< LearningBasedWB > createLearningBasedWB(const String &path_to_model=String())
int last_id
Last object id to allocate.
virtual void balanceWhite(InputArray src, OutputArray dst)=0