19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
22 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=2);
25 vector<MxArray> rhs(prhs, prhs+nrhs);
29 int normType = cv::NORM_L2;
33 bool crosscheck =
false;
34 for (
int i=2; i<nrhs; i+=2) {
35 string key(rhs[i].toString());
37 dtype = (rhs[i+1].isChar()) ?
39 else if (key==
"NormType")
40 normType =
NormType[rhs[i+1].toString()];
44 mask = rhs[i+1].toMat(CV_8U);
45 else if (key==
"Update")
46 update = rhs[i+1].toInt();
47 else if (key==
"CrossCheck")
48 crosscheck = rhs[i+1].toBool();
50 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
54 Mat src1(rhs[0].toMat(rhs[0].isUint8() ? CV_8U : CV_32F)),
55 src2(rhs[1].toMat(rhs[1].isUint8() ? CV_8U : CV_32F));
57 batchDistance(src1, src2, dst, dtype, (K>0 ? nidx : noArray()),
58 normType, K, mask, update, crosscheck);
const ConstMap< std::string, int > ClassNameMap
Translates class name used in MATLAB to equivalent OpenCV depth.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.
const ConstMap< std::string, int > NormType
Norm type map for option processing.