39 int id = rhs[0].toInt();
40 string method(rhs[1].toString());
43 if (method ==
"new") {
44 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
45 int clusterCount = rhs[2].toInt();
49 for (
int i=3; i<nrhs; i+=2) {
50 string key(rhs[i].toString());
51 if (key ==
"Criteria")
52 criteria = rhs[i+1].toTermCriteria();
53 else if (key ==
"Attempts")
54 attempts = rhs[i+1].toInt();
55 else if (key ==
"Initialization")
59 "Unrecognized option %s", key.
c_str());
62 clusterCount, criteria, attempts, flags);
72 if (method ==
"delete") {
77 else if (method ==
"clear") {
81 else if (method ==
"getDescriptors") {
86 else if (method ==
"descriptorsCount") {
91 else if (method ==
"add") {
95 else if (method ==
"cluster") {
96 nargchk((nrhs==2 || nrhs==3) && nlhs<=1);
106 "Unrecognized operation %s", method.
c_str());
virtual Mat cluster() const
void add(const Mat &descriptors)
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
struct mxArray_tag mxArray
Forward declaration for mxArray.
int last_id
Last object id to allocate.
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...
const std::vector< Mat > & getDescriptors() const
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.
int descriptorsCount() const
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Global constant definitions.
map< int, Ptr< BOWKMeansTrainer > > obj_
Object container.
std::map wrapper with one-line initialization and lookup method.
const ConstMap< string, int > KmeansInitMap
KMeans initalization types.