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 ==
"Levels")
159 else if (prop ==
"VotesThreshold")
163 "Unrecognized property %s", prop.
c_str());
165 else if (method ==
"set") {
167 string prop(rhs[2].toString());
168 if (prop ==
"CannyHighThresh")
170 else if (prop ==
"CannyLowThresh")
172 else if (prop ==
"Dp")
173 obj->
setDp(rhs[3].toDouble());
174 else if (prop ==
"MaxBufferSize")
176 else if (prop ==
"MinDist")
178 else if (prop ==
"Levels")
180 else if (prop ==
"VotesThreshold")
184 "Unrecognized property %s", prop.
c_str());
188 "Unrecognized operation %s", method.
c_str());
virtual double getMinDist() const=0
virtual int getCannyLowThresh() const=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 int getVotesThreshold() const=0
virtual bool isOpened() const
map< int, Ptr< GeneralizedHoughBallard > > obj_
Object container.
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual void setCannyLowThresh(int cannyLowThresh)=0
virtual void setMinDist(double minDist)=0
virtual void setDp(double dp)=0
virtual void read(const FileNode &fn)
InputOutputArray noArray()
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 void setTemplate(InputArray templ, Point templCenter=Point(-1, -1))=0
virtual void setLevels(int levels)=0
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
Ptr< GeneralizedHoughBallard > createGeneralizedHoughBallard()
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
FileNode getFirstTopLevelNode() const
virtual void setVotesThreshold(int votesThreshold)=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
int last_id
Last object id to allocate.
virtual void setCannyHighThresh(int cannyHighThresh)=0
virtual void save(const String &filename) const
virtual bool empty() const
virtual int getLevels() const=0