15 (
"I1", CV_CONTOURS_MATCH_I1)
16 (
"I2", CV_CONTOURS_MATCH_I2)
17 (
"I3", CV_CONTOURS_MATCH_I3);
27 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
30 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
33 vector<MxArray> rhs(prhs, prhs+nrhs);
36 int method = CV_CONTOURS_MATCH_I1;
38 for (
int i=2; i<nrhs; i+=2) {
39 string key(rhs[i].toString());
41 method = ShapeMatchMethodsMap[rhs[i+1].toString()];
42 else if (key==
"Parameter")
43 parameter = rhs[i+1].toDouble();
45 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
50 if ((rhs[0].isNumeric() || rhs[0].isLogical()) &&
51 (rhs[1].isNumeric() || rhs[1].isLogical())) {
52 Mat contour1(rhs[0].toMat()),
53 contour2(rhs[1].toMat());
54 result = matchShapes(contour1, contour2, method, parameter);
56 else if (rhs[0].isCell() && rhs[1].isCell()) {
57 vector<Point2f> contour1(rhs[0].toVector<Point2f>()),
58 contour2(rhs[1].toVector<Point2f>());
59 result = matchShapes(contour1, contour2, method, parameter);
62 mexErrMsgIdAndTxt(
"mexopencv:error",
"Invalid argument");
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
std::map wrapper with one-line initialization and lookup method.