36 int id = rhs[0].toInt();
37 string method(rhs[1].toString());
40 if (method ==
"new") {
52 if (method ==
"delete") {
57 else if (method ==
"clear") {
61 else if (method ==
"load") {
62 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
64 bool loadFromString =
false;
65 for (
int i=3; i<nrhs; i+=2) {
66 string key(rhs[i].toString());
68 objname = rhs[i+1].toString();
69 else if (key ==
"FromString")
70 loadFromString = rhs[i+1].toBool();
73 "Unrecognized option %s", key.
c_str());
82 FileStorage fs(rhs[2].toString(), FileStorage::READ +
83 (loadFromString ? FileStorage::MEMORY : 0));
92 else if (method ==
"save") {
94 obj->
save(rhs[2].toString());
96 else if (method ==
"empty") {
100 else if (method ==
"getDefaultName") {
104 else if (method ==
"setup") {
105 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs==0);
106 float photoreceptorsNeighborhoodRadius = 3.f;
107 float ganglioncellsNeighborhoodRadius = 1.f;
108 float meanLuminanceModulatorK = 1.f;
109 for (
int i=2; i<nrhs; i+=2) {
110 string key(rhs[i].toString());
111 if (key ==
"PhotoreceptorsNeighborhoodRadius")
112 photoreceptorsNeighborhoodRadius = rhs[i+1].toFloat();
113 else if (key ==
"GanglioncellsNeighborhoodRadius")
114 ganglioncellsNeighborhoodRadius = rhs[i+1].toFloat();
115 else if (key ==
"MeanLuminanceModulatorK")
116 meanLuminanceModulatorK = rhs[i+1].toFloat();
119 "Unrecognized option %s", key.
c_str());
121 obj->
setup(photoreceptorsNeighborhoodRadius,
122 ganglioncellsNeighborhoodRadius, meanLuminanceModulatorK);
124 else if (method ==
"applyFastToneMapping") {
127 outputToneMappedImage;
129 plhs[0] =
MxArray(outputToneMappedImage);
133 "Unrecognized operation %s", method.
c_str());
virtual void setup(const float photoreceptorsNeighborhoodRadius=3.f, const float ganglioncellsNeighborhoodRadius=1.f, const float meanLuminanceModulatorK=1.f)=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.
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
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...
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
map< int, Ptr< RetinaFastToneMapping > > obj_
Object container.
virtual String getDefaultName() const
Global constant definitions.
int last_id
Last object id to allocate.
virtual void save(const String &filename) const
virtual bool empty() const
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
virtual void applyFastToneMapping(InputArray inputImage, OutputArray outputToneMappedImage)=0