32 for (; first != last; first += 2) {
33 string key(first->toString());
34 const MxArray& val = *(first + 1);
39 "Unrecognized option %s", key.c_str());
59 int id = rhs[0].toInt();
60 string method(rhs[1].toString());
63 if (method ==
"new") {
76 if (method ==
"delete") {
81 else if (method ==
"clear") {
85 else if (method ==
"load") {
86 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
88 bool loadFromString =
false;
89 for (
int i=3; i<nrhs; i+=2) {
90 string key(rhs[i].toString());
92 objname = rhs[i+1].toString();
93 else if (key ==
"FromString")
94 loadFromString = rhs[i+1].toBool();
97 "Unrecognized option %s", key.
c_str());
106 FileStorage fs(rhs[2].toString(), FileStorage::READ +
107 (loadFromString ? FileStorage::MEMORY : 0));
116 else if (method ==
"save") {
118 obj->
save(rhs[2].toString());
120 else if (method ==
"empty") {
124 else if (method ==
"getDefaultName") {
128 else if (method ==
"process") {
134 else if (method ==
"get") {
136 string prop(rhs[2].toString());
141 "Unrecognized property %s", prop.
c_str());
143 else if (method ==
"set") {
145 string prop(rhs[2].toString());
150 "Unrecognized property %s", prop.
c_str());
154 "Unrecognized operation %s", method.
c_str());
virtual float getGamma() const=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Ptr< Tonemap > create_Tonemap(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of Tonemap using options in arguments.
map< int, Ptr< Tonemap > > obj_
Object container.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
int last_id
Last object id to allocate.
virtual void read(const FileNode &fn)
Ptr< Tonemap > createTonemap(float gamma=1.0f)
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 void setGamma(float gamma)=0
float toFloat() const
Convert MxArray to float.
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 save(const String &filename) const
virtual bool empty() const
virtual void process(InputArray src, OutputArray dst)=0