30 const char* fields[] = {
"rect",
"score",
"class"};
32 for (
size_t i=0; i<vo.
size(); ++i) {
33 s.
set(
"rect", vo[i].rect, i);
34 s.
set(
"score", vo[i].score, i);
35 if (vo[i].classID >= 0 && vo[i].classID < classNames.
size())
36 s.
set(
"class", classNames[vo[i].classID], i);
40 s.
set(
"class", ss.
str(), i);
62 int id = rhs[0].toInt();
63 string method(rhs[1].toString());
66 if (method ==
"new") {
67 nargchk((nrhs==3 || nrhs==4) && nlhs<=1);
71 rhs[3].toVector<
string>());
81 if (method ==
"delete") {
86 else if (method ==
"isEmpty") {
90 else if (method ==
"detect") {
94 obj->
detect(image, objects);
97 else if (method ==
"getClassNames") {
101 else if (method ==
"getClassCount") {
107 "Unrecognized operation %s", method.
c_str());
int last_id
Last object id to allocate.
map< int, Ptr< DPMDetector > > obj_
Object container.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
MxArray toStruct(const vector< DPMDetector::ObjectDetection > &vo, const vector< string > &classNames)
Convert object detections to struct array.
virtual std::vector< std::string > const & getClassNames() const=0
struct mxArray_tag mxArray
Forward declaration for mxArray.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
virtual size_t getClassCount() const=0
virtual void detect(cv::Mat &image, std::vector< ObjectDetection > &objects)=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
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.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
static MxArray Struct(const char **fields=NULL, int nfields=0, mwSize m=1, mwSize n=1)
Create a new struct array.
Global constant definitions.
virtual bool isEmpty() const=0
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)