19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 bool scale_variant = (nrhs>=3 &&
29 rhs[1].isNumeric() && rhs[1].numel()==1 &&
30 rhs[2].isNumeric() && rhs[2].numel()==1);
31 nargchk((nrhs%2) == (scale_variant ? 1 : 0));
34 int interpolation = cv::INTER_LINEAR;
35 for (
int i=(scale_variant ? 3 : 2); i<nrhs; i+=2) {
36 string key(rhs[i].toString());
37 if (key==
"Interpolation")
38 interpolation =
InterpType[rhs[i+1].toString()];
40 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
45 double fx = 0, fy = 0;
47 fx = rhs[1].toDouble();
48 fy = rhs[2].toDouble();
51 dsize = rhs[1].toSize();
54 Mat src(rhs[0].toMat()), dst;
55 resize(src, dst, dsize, fx, fy, interpolation);
const ConstMap< std::string, int > InterpType
Interpolation type map for option processing.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Global constant definitions.