36 int id = rhs[0].toInt();
37 string method(rhs[1].toString());
40 if (method ==
"new") {
41 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
45 float minScore = 0.01f;
47 float edgeMinMag = 0.1f;
48 float edgeMergeThr = 0.5f;
49 float clusterMinMag = 0.5f;
50 float maxAspectRatio = 3;
51 float minBoxArea = 1000;
54 for (
int i=2; i<nrhs; i+=2) {
55 string key(rhs[i].toString());
57 alpha = rhs[i+1].toFloat();
58 else if (key ==
"Beta")
59 beta = rhs[i+1].toFloat();
60 else if (key ==
"Eta")
61 eta = rhs[i+1].toFloat();
62 else if (key ==
"MinScore")
63 minScore = rhs[i+1].toFloat();
64 else if (key ==
"MaxBoxes")
65 maxBoxes = rhs[i+1].toInt();
66 else if (key ==
"EdgeMinMag")
67 edgeMinMag = rhs[i+1].toFloat();
68 else if (key ==
"EdgeMergeThr")
69 edgeMergeThr = rhs[i+1].toFloat();
70 else if (key ==
"ClusterMinMag")
71 clusterMinMag = rhs[i+1].toFloat();
72 else if (key ==
"MaxAspectRatio")
73 maxAspectRatio = rhs[i+1].toFloat();
74 else if (key ==
"MinBoxArea")
75 minBoxArea = rhs[i+1].toFloat();
76 else if (key ==
"Gamma")
77 gamma = rhs[i+1].toFloat();
78 else if (key ==
"Kappa")
79 kappa = rhs[i+1].toFloat();
82 "Unrecognized option %s", key.
c_str());
85 maxBoxes, edgeMinMag, edgeMergeThr, clusterMinMag, maxAspectRatio,
86 minBoxArea, gamma, kappa);
96 if (method ==
"delete") {
101 else if (method ==
"clear") {
105 else if (method ==
"load") {
106 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
108 bool loadFromString =
false;
109 for (
int i=3; i<nrhs; i+=2) {
110 string key(rhs[i].toString());
111 if (key ==
"ObjName")
112 objname = rhs[i+1].toString();
113 else if (key ==
"FromString")
114 loadFromString = rhs[i+1].toBool();
117 "Unrecognized option %s", key.
c_str());
126 FileStorage fs(rhs[2].toString(), FileStorage::READ +
127 (loadFromString ? FileStorage::MEMORY : 0));
136 else if (method ==
"save") {
138 obj->
save(rhs[2].toString());
140 else if (method ==
"empty") {
144 else if (method ==
"getDefaultName") {
148 else if (method ==
"getBoundingBoxes") {
156 else if (method ==
"get") {
158 string prop(rhs[2].toString());
161 else if (prop ==
"Beta")
163 else if (prop ==
"Eta")
165 else if (prop ==
"MinScore")
167 else if (prop ==
"MaxBoxes")
169 else if (prop ==
"EdgeMinMag")
171 else if (prop ==
"EdgeMergeThr")
173 else if (prop ==
"ClusterMinMag")
175 else if (prop ==
"MaxAspectRatio")
177 else if (prop ==
"MinBoxArea")
179 else if (prop ==
"Gamma")
181 else if (prop ==
"Kappa")
185 "Unrecognized property %s", prop.
c_str());
187 else if (method ==
"set") {
189 string prop(rhs[2].toString());
192 else if (prop ==
"Beta")
193 obj->
setBeta(rhs[3].toFloat());
194 else if (prop ==
"Eta")
195 obj->
setEta(rhs[3].toFloat());
196 else if (prop ==
"MinScore")
198 else if (prop ==
"MaxBoxes")
200 else if (prop ==
"EdgeMinMag")
202 else if (prop ==
"EdgeMergeThr")
204 else if (prop ==
"ClusterMinMag")
206 else if (prop ==
"MaxAspectRatio")
208 else if (prop ==
"MinBoxArea")
210 else if (prop ==
"Gamma")
212 else if (prop ==
"Kappa")
216 "Unrecognized property %s", prop.
c_str());
220 "Unrecognized operation %s", method.
c_str());
virtual float getClusterMinMag() const=0
Ptr< EdgeBoxes > createEdgeBoxes(float alpha=0.65f, float beta=0.75f, float eta=1, float minScore=0.01f, int maxBoxes=10000, float edgeMinMag=0.1f, float edgeMergeThr=0.5f, float clusterMinMag=0.5f, float maxAspectRatio=3, float minBoxArea=1000, float gamma=2, float kappa=1.5f)
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual void setMaxAspectRatio(float value)=0
int last_id
Last object id to allocate.
virtual float getMaxAspectRatio() const=0
virtual int getMaxBoxes() const=0
virtual void setMaxBoxes(int value)=0
virtual void getBoundingBoxes(InputArray edge_map, InputArray orientation_map, std::vector< Rect > &boxes)=0
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual void setClusterMinMag(float value)=0
virtual float getAlpha() const=0
virtual float getKappa() const=0
virtual void read(const FileNode &fn)
virtual float getMinScore() const=0
virtual void setEdgeMinMag(float value)=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 float getMinBoxArea() const=0
virtual float getEdgeMinMag() const=0
virtual void setEdgeMergeThr(float value)=0
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
virtual float getEta() const=0
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
virtual void setKappa(float value)=0
virtual float getEdgeMergeThr() const=0
FileNode getFirstTopLevelNode() const
virtual void setMinBoxArea(float value)=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual String getDefaultName() const
Global constant definitions.
virtual void setAlpha(float value)=0
map< int, Ptr< EdgeBoxes > > obj_
Object container.
virtual float getGamma() const=0
virtual void setEta(float value)=0
virtual void setBeta(float value)=0
virtual void save(const String &filename) const
virtual bool empty() const
virtual float getBeta() const=0
virtual void setGamma(float value)=0
virtual void setMinScore(float value)=0