33 float saturation = 1.0f;
34 for (; first != last; first += 2) {
35 string key(first->toString());
36 const MxArray& val = *(first + 1);
39 else if (key ==
"Scale")
40 scale = val.toFloat();
41 else if (key ==
"Saturation")
42 saturation = val.toFloat();
45 "Unrecognized option %s", key.c_str());
65 int id = rhs[0].toInt();
66 string method(rhs[1].toString());
69 if (method ==
"new") {
82 if (method ==
"delete") {
87 else if (method ==
"clear") {
91 else if (method ==
"load") {
92 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
94 bool loadFromString =
false;
95 for (
int i=3; i<nrhs; i+=2) {
96 string key(rhs[i].toString());
98 objname = rhs[i+1].toString();
99 else if (key ==
"FromString")
100 loadFromString = rhs[i+1].toBool();
103 "Unrecognized option %s", key.
c_str());
112 FileStorage fs(rhs[2].toString(), FileStorage::READ +
113 (loadFromString ? FileStorage::MEMORY : 0));
122 else if (method ==
"save") {
124 obj->
save(rhs[2].toString());
126 else if (method ==
"empty") {
130 else if (method ==
"getDefaultName") {
134 else if (method ==
"process") {
140 else if (method ==
"get") {
142 string prop(rhs[2].toString());
145 else if (prop ==
"Scale")
147 else if (prop ==
"Saturation")
151 "Unrecognized property %s", prop.
c_str());
153 else if (method ==
"set") {
155 string prop(rhs[2].toString());
158 else if (prop ==
"Scale")
160 else if (prop ==
"Saturation")
164 "Unrecognized property %s", prop.
c_str());
168 "Unrecognized operation %s", method.
c_str());
virtual float getGamma() const=0
map< int, Ptr< TonemapMantiuk > > obj_
Object container.
virtual void setScale(float scale)=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual void setSaturation(float saturation)=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Ptr< TonemapMantiuk > create_TonemapMantiuk(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of TonemapMantiuk using options in arguments.
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual float getSaturation() const=0
Ptr< TonemapMantiuk > createTonemapMantiuk(float gamma=1.0f, float scale=0.7f, float saturation=1.0f)
int last_id
Last object id to allocate.
virtual float getScale() 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...
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