32 float intensity = 0.0f;
33 float light_adapt = 1.0f;
34 float color_adapt = 0.0f;
35 for (; first != last; first += 2) {
36 string key(first->toString());
37 const MxArray& val = *(first + 1);
40 else if (key ==
"Intensity")
41 intensity = val.toFloat();
42 else if (key ==
"LightAdaptation")
43 light_adapt = val.toFloat();
44 else if (key ==
"ColorAdaptation")
45 color_adapt = val.toFloat();
48 "Unrecognized option %s", key.c_str());
68 int id = rhs[0].toInt();
69 string method(rhs[1].toString());
72 if (method ==
"new") {
85 if (method ==
"delete") {
90 else if (method ==
"clear") {
94 else if (method ==
"load") {
95 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
97 bool loadFromString =
false;
98 for (
int i=3; i<nrhs; i+=2) {
99 string key(rhs[i].toString());
100 if (key ==
"ObjName")
101 objname = rhs[i+1].toString();
102 else if (key ==
"FromString")
103 loadFromString = rhs[i+1].toBool();
106 "Unrecognized option %s", key.
c_str());
115 FileStorage fs(rhs[2].toString(), FileStorage::READ +
116 (loadFromString ? FileStorage::MEMORY : 0));
125 else if (method ==
"save") {
127 obj->
save(rhs[2].toString());
129 else if (method ==
"empty") {
133 else if (method ==
"getDefaultName") {
137 else if (method ==
"process") {
143 else if (method ==
"get") {
145 string prop(rhs[2].toString());
148 else if (prop ==
"Intensity")
150 else if (prop ==
"LightAdaptation")
152 else if (prop ==
"ColorAdaptation")
156 "Unrecognized property %s", prop.
c_str());
158 else if (method ==
"set") {
160 string prop(rhs[2].toString());
163 else if (prop ==
"Intensity")
165 else if (prop ==
"LightAdaptation")
167 else if (prop ==
"ColorAdaptation")
171 "Unrecognized property %s", prop.
c_str());
175 "Unrecognized operation %s", method.
c_str());
virtual float getGamma() const=0
virtual float getColorAdaptation() 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.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual float getIntensity() const=0
map< int, Ptr< TonemapReinhard > > obj_
Object container.
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual void read(const FileNode &fn)
Ptr< TonemapReinhard > createTonemapReinhard(float gamma=1.0f, float intensity=0.0f, float light_adapt=1.0f, float color_adapt=0.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.
virtual float getLightAdaptation() const=0
FileNode getFirstTopLevelNode() const
virtual void setColorAdaptation(float color_adapt)=0
virtual void setIntensity(float intensity)=0
virtual String getDefaultName() const
Global constant definitions.
virtual void save(const String &filename) const
virtual bool empty() const
virtual void setLightAdaptation(float light_adapt)=0
Ptr< TonemapReinhard > create_TonemapReinhard(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of TonemapReinhard using options in arguments.
virtual void process(InputArray src, OutputArray dst)=0