32 float contrast = 4.0f;
33 float saturation = 1.0f;
34 float sigma_space = 2.0f;
35 float sigma_color = 2.0f;
36 for (; first != last; first += 2) {
37 string key(first->toString());
38 const MxArray& val = *(first + 1);
41 else if (key ==
"Contrast")
42 contrast = val.toFloat();
43 else if (key ==
"Saturation")
44 saturation = val.toFloat();
45 else if (key ==
"SigmaSpace")
46 sigma_space = val.toFloat();
47 else if (key ==
"SigmaColor")
48 sigma_color = val.toFloat();
51 "Unrecognized option %s", key.c_str());
71 int id = rhs[0].toInt();
72 string method(rhs[1].toString());
75 if (method ==
"new") {
88 if (method ==
"delete") {
93 else if (method ==
"clear") {
97 else if (method ==
"load") {
98 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
100 bool loadFromString =
false;
101 for (
int i=3; i<nrhs; i+=2) {
102 string key(rhs[i].toString());
103 if (key ==
"ObjName")
104 objname = rhs[i+1].toString();
105 else if (key ==
"FromString")
106 loadFromString = rhs[i+1].toBool();
109 "Unrecognized option %s", key.
c_str());
118 FileStorage fs(rhs[2].toString(), FileStorage::READ +
119 (loadFromString ? FileStorage::MEMORY : 0));
128 else if (method ==
"save") {
130 obj->
save(rhs[2].toString());
132 else if (method ==
"empty") {
136 else if (method ==
"getDefaultName") {
140 else if (method ==
"process") {
146 else if (method ==
"get") {
148 string prop(rhs[2].toString());
151 else if (prop ==
"Contrast")
153 else if (prop ==
"Saturation")
155 else if (prop ==
"SigmaSpace")
157 else if (prop ==
"SigmaColor")
161 "Unrecognized property %s", prop.
c_str());
163 else if (method ==
"set") {
165 string prop(rhs[2].toString());
168 else if (prop ==
"Contrast")
170 else if (prop ==
"Saturation")
172 else if (prop ==
"SigmaSpace")
174 else if (prop ==
"SigmaColor")
178 "Unrecognized property %s", prop.
c_str());
182 "Unrecognized operation %s", method.
c_str());
virtual void setSigmaColor(float sigma_color)=0
virtual float getGamma() const=0
int last_id
Last object id to allocate.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual float getSigmaSpace() const=0
virtual void setContrast(float contrast)=0
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual void setSigmaSpace(float sigma_space)=0
virtual float getSaturation() const=0
virtual void read(const FileNode &fn)
virtual float getSigmaColor() const=0
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.
Ptr< TonemapDurand > create_TonemapDurand(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of TonemapDurand using options in arguments.
virtual void setSaturation(float saturation)=0
Ptr< TonemapDurand > createTonemapDurand(float gamma=1.0f, float contrast=4.0f, float saturation=1.0f, float sigma_space=2.0f, float sigma_color=2.0f)
virtual void save(const String &filename) const
virtual bool empty() const
map< int, Ptr< TonemapDurand > > obj_
Object container.
virtual void process(InputArray src, OutputArray dst)=0
virtual float getContrast() const=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.