36 adjust_outliers(
false)
40 for (; first != last; first += 2) {
41 string key(first->toString());
42 const MxArray& val = *(first + 1);
45 else if (key ==
"SigmaR")
46 sigma_r = val.toDouble();
47 else if (key ==
"AdjustOutliers")
48 adjust_outliers = val.toBool();
51 "Unrecognized option %s", key.c_str());
71 int id = rhs[0].toInt();
72 string method(rhs[1].toString());
75 if (method ==
"new") {
77 OptionsParser opts(rhs.
begin() + 2, rhs.
end());
79 opts.sigma_s, opts.sigma_r, opts.adjust_outliers);
85 else if (method ==
"amFilter") {
91 OptionsParser opts(rhs.
begin() + 4, rhs.
end());
93 opts.sigma_s, opts.sigma_r, opts.adjust_outliers);
102 if (method ==
"delete") {
107 else if (method ==
"clear") {
111 else if (method ==
"load") {
112 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
114 bool loadFromString =
false;
115 for (
int i=3; i<nrhs; i+=2) {
116 string key(rhs[i].toString());
117 if (key ==
"ObjName")
118 objname = rhs[i+1].toString();
119 else if (key ==
"FromString")
120 loadFromString = rhs[i+1].toBool();
123 "Unrecognized option %s", key.
c_str());
132 FileStorage fs(rhs[2].toString(), FileStorage::READ +
133 (loadFromString ? FileStorage::MEMORY : 0));
142 else if (method ==
"save") {
144 obj->
save(rhs[2].toString());
146 else if (method ==
"empty") {
150 else if (method ==
"getDefaultName") {
154 else if (method ==
"collectGarbage") {
158 else if (method ==
"filter") {
159 nargchk((nrhs==3 || nrhs==4) && nlhs<=1);
163 joint = rhs[3].toMat(rhs[3].isUint8() ?
CV_8U :
168 else if (method ==
"get") {
170 string prop(rhs[2].toString());
171 if (prop ==
"SigmaS")
173 else if (prop ==
"SigmaR")
175 else if (prop ==
"TreeHeight")
177 else if (prop ==
"PCAIterations")
179 else if (prop ==
"AdjustOutliers")
181 else if (prop ==
"UseRNG")
185 "Unrecognized property %s", prop.
c_str());
187 else if (method ==
"set") {
189 string prop(rhs[2].toString());
190 if (prop ==
"SigmaS")
192 else if (prop ==
"SigmaR")
194 else if (prop ==
"TreeHeight")
196 else if (prop ==
"PCAIterations")
198 else if (prop ==
"AdjustOutliers")
200 else if (prop ==
"UseRNG")
204 "Unrecognized property %s", prop.
c_str());
208 "Unrecognized operation %s", method.
c_str());
virtual void setAdjustOutliers(bool val)=0
virtual double getSigmaS() const=0
virtual void setTreeHeight(int val)=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual int getPCAIterations() const=0
virtual bool getUseRNG() const=0
virtual double getSigmaR() const=0
virtual void setPCAIterations(int val)=0
virtual void setSigmaR(double val)=0
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual int getTreeHeight() const=0
virtual void setSigmaS(double val)=0
OptionsParser(vector< MxArray >::const_iterator first, vector< MxArray >::const_iterator last)
Parse input arguments.
virtual void filter(InputArray src, OutputArray dst, InputArray joint=noArray())=0
virtual void read(const FileNode &fn)
virtual bool getAdjustOutliers() const=0
InputOutputArray noArray()
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.
Option arguments parser used by create and filter methods.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
FileNode getFirstTopLevelNode() const
virtual void setUseRNG(bool val)=0
virtual String getDefaultName() const
Global constant definitions.
double toDouble() const
Convert MxArray to double.
virtual void collectGarbage()=0
virtual void save(const String &filename) const
virtual bool empty() const
int last_id
Last object id to allocate.
void amFilter(InputArray joint, InputArray src, OutputArray dst, double sigma_s, double sigma_r, bool adjust_outliers=false)
Ptr< AdaptiveManifoldFilter > createAMFilter(double sigma_s, double sigma_r, bool adjust_outliers=false)
map< int, Ptr< AdaptiveManifoldFilter > > obj_
Object container.