35 int id = rhs[0].toInt();
36 string method(rhs[1].toString());
39 if (method ==
"new") {
51 if (method ==
"delete") {
56 else if (method ==
"clear") {
60 else if (method ==
"load") {
61 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
63 bool loadFromString =
false;
64 for (
int i=3; i<nrhs; i+=2) {
65 string key(rhs[i].toString());
67 objname = rhs[i+1].toString();
68 else if (key ==
"FromString")
69 loadFromString = rhs[i+1].toBool();
72 "Unrecognized option %s", key.
c_str());
81 FileStorage fs(rhs[2].toString(), FileStorage::READ +
82 (loadFromString ? FileStorage::MEMORY : 0));
91 else if (method ==
"save") {
93 obj->
save(rhs[2].toString());
95 else if (method ==
"empty") {
99 else if (method ==
"getDefaultName") {
103 else if (method ==
"detect") {
104 nargchk((nrhs==3 || nrhs==5) && nlhs<=2);
115 obj->
detect(edges, dx, dy, positions, (nlhs>1) ? votes :
noArray());
121 else if (method ==
"setTemplate") {
122 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
123 bool edges_variant = (nrhs>=5 && rhs[3].isNumeric() && rhs[4].isNumeric());
124 Point templCenter(-1,-1);
125 for (
int i=(edges_variant ? 5 : 3); i<nrhs; i+=2) {
126 string key(rhs[i].toString());
128 templCenter = rhs[i+1].toPoint();
131 "Unrecognized option %s", key.
c_str());
144 else if (method ==
"get") {
146 string prop(rhs[2].toString());
147 if (prop ==
"CannyHighThresh")
149 else if (prop ==
"CannyLowThresh")
151 else if (prop ==
"Dp")
153 else if (prop ==
"MaxBufferSize")
155 else if (prop ==
"MinDist")
157 else if (prop ==
"AngleEpsilon")
159 else if (prop ==
"AngleStep")
161 else if (prop ==
"AngleThresh")
163 else if (prop ==
"Levels")
165 else if (prop ==
"MaxAngle")
167 else if (prop ==
"MaxScale")
169 else if (prop ==
"MinAngle")
171 else if (prop ==
"MinScale")
173 else if (prop ==
"PosThresh")
175 else if (prop ==
"ScaleStep")
177 else if (prop ==
"ScaleThresh")
179 else if (prop ==
"Xi")
183 "Unrecognized property %s", prop.
c_str());
185 else if (method ==
"set") {
187 string prop(rhs[2].toString());
188 if (prop ==
"CannyHighThresh")
190 else if (prop ==
"CannyLowThresh")
192 else if (prop ==
"Dp")
193 obj->
setDp(rhs[3].toDouble());
194 else if (prop ==
"MaxBufferSize")
196 else if (prop ==
"MinDist")
198 else if (prop ==
"AngleEpsilon")
200 else if (prop ==
"AngleStep")
202 else if (prop ==
"AngleThresh")
204 else if (prop ==
"Levels")
206 else if (prop ==
"MaxAngle")
208 else if (prop ==
"MaxScale")
210 else if (prop ==
"MinAngle")
212 else if (prop ==
"MinScale")
214 else if (prop ==
"PosThresh")
216 else if (prop ==
"ScaleStep")
218 else if (prop ==
"ScaleThresh")
220 else if (prop ==
"Xi")
221 obj->
setXi(rhs[3].toDouble());
224 "Unrecognized property %s", prop.
c_str());
228 "Unrecognized operation %s", method.
c_str());
virtual double getAngleStep() const=0
virtual double getAngleEpsilon() const=0
virtual double getMinDist() const=0
virtual void setMinAngle(double minAngle)=0
virtual int getCannyLowThresh() const=0
virtual void setScaleStep(double scaleStep)=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual void setMaxScale(double maxScale)=0
virtual void setMinScale(double minScale)=0
map< int, Ptr< GeneralizedHoughGuil > > obj_
Object container.
virtual void setMaxAngle(double maxAngle)=0
virtual bool isOpened() const
virtual void setAngleThresh(int angleThresh)=0
int last_id
Last object id to allocate.
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual double getMinScale() const=0
virtual int getAngleThresh() const=0
virtual void setAngleEpsilon(double angleEpsilon)=0
virtual int getPosThresh() const=0
virtual void setCannyLowThresh(int cannyLowThresh)=0
virtual void setPosThresh(int posThresh)=0
virtual void setMinDist(double minDist)=0
Ptr< GeneralizedHoughGuil > createGeneralizedHoughGuil()
virtual void setDp(double dp)=0
virtual void read(const FileNode &fn)
virtual double getMaxAngle() const=0
InputOutputArray noArray()
virtual double getScaleStep() const=0
virtual void setMaxBufferSize(int maxBufferSize)=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 int getCannyHighThresh() const=0
virtual double getMinAngle() const=0
virtual void setTemplate(InputArray templ, Point templCenter=Point(-1, -1))=0
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
virtual int getScaleThresh() const=0
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
FileNode getFirstTopLevelNode() const
virtual double getMaxScale() const=0
virtual void setLevels(int levels)=0
virtual void setXi(double xi)=0
virtual void detect(InputArray image, OutputArray positions, OutputArray votes=noArray())=0
virtual String getDefaultName() const
Global constant definitions.
virtual int getMaxBufferSize() const=0
virtual double getDp() const=0
virtual void setCannyHighThresh(int cannyHighThresh)=0
virtual void save(const String &filename) const
virtual bool empty() const
virtual int getLevels() const=0
virtual void setAngleStep(double angleStep)=0
virtual double getXi() const=0
virtual void setScaleThresh(int scaleThresh)=0