31 float contrast_weight = 1.0f;
32 float saturation_weight = 1.0f;
33 float exposure_weight = 0.0f;
34 for (; first != last; first += 2) {
35 string key(first->toString());
36 const MxArray& val = *(first + 1);
37 if (key ==
"ContrastWeight")
38 contrast_weight = val.
toFloat();
39 else if (key ==
"SaturationWeight")
40 saturation_weight = val.toFloat();
41 else if (key ==
"ExposureWeight")
42 exposure_weight = 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") {
147 else if (method ==
"get") {
149 string prop(rhs[2].toString());
150 if (prop ==
"ContrastWeight")
152 else if (prop ==
"SaturationWeight")
154 else if (prop ==
"ExposureWeight ")
158 "Unrecognized property %s", prop.
c_str());
160 else if (method ==
"set") {
162 string prop(rhs[2].toString());
163 if (prop ==
"ContrastWeight")
165 else if (prop ==
"SaturationWeight")
167 else if (prop ==
"ExposureWeight")
171 "Unrecognized property %s", prop.
c_str());
175 "Unrecognized operation %s", method.
c_str());
Ptr< MergeMertens > createMergeMertens(float contrast_weight=1.0f, float saturation_weight=1.0f, float exposure_weight=0.0f)
virtual void setExposureWeight(float exposure_weight)=0
virtual float getSaturationWeight() const=0
virtual void process(InputArrayOfArrays src, OutputArray dst, InputArray times, InputArray response)=0
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.
int last_id
Last object id to allocate.
virtual void setSaturationWeight(float saturation_weight)=0
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
map< int, Ptr< MergeMertens > > obj_
Object container.
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...
float toFloat() const
Convert MxArray to float.
Ptr< MergeMertens > create_MergeMertens(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Create an instance of MergeMertens using options in arguments.
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 getContrastWeight() const=0
FileNode getFirstTopLevelNode() const
virtual void setContrastWeight(float contrast_weiht)=0
virtual String getDefaultName() const
Global constant definitions.
virtual void save(const String &filename) const
virtual bool empty() const
virtual float getExposureWeight() const=0