21 const char *fields[4] = {
"bbox",
"class_idx",
"label_name",
"class_prob"};
24 int bbox[4] = {detections[i].xmin, detections[i].ymin,
25 detections[i].xmax, detections[i].ymax};
27 s.
set(fields[1], static_cast<int>(detections[i].class_idx), i);
28 s.
set(fields[2], detections[i].label_name, i);
29 s.
set(fields[3], detections[i].class_prob, i);
45 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
52 for (
int i=3; i<nrhs; i+=2) {
53 string key(rhs[i].toString());
54 if (key ==
"Threshold")
55 thresh = rhs[i+1].toDouble();
58 "Unrecognized option %s", key.
c_str());
62 MatND delta_bbox(rhs[0].toMatND(
CV_32F)),
63 class_scores(rhs[1].toMatND(
CV_32F)),
64 conf_scores(rhs[2].toMatND(
CV_32F));
MxArray toStruct(const vector< cv::dnn_objdetect::object > &detections)
Convert detections to struct array.
struct mxArray_tag mxArray
Forward declaration for mxArray.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
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...
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.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.