19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 bool separate_variant = (nrhs>=3 && rhs[2].isNumeric());
29 nargchk((nrhs%2) == (separate_variant ? 1 : 0));
33 int interpolation = cv::INTER_LINEAR;
34 int borderMode = cv::BORDER_CONSTANT;
36 for (
int i=(separate_variant ? 3 : 2); i<nrhs; i+=2) {
37 string key(rhs[i].toString());
39 dst = rhs[i+1].toMat();
40 else if (key==
"Interpolation")
41 interpolation = (rhs[i+1].isChar()) ?
42 InterpType[rhs[i+1].toString()] : rhs[i+1].toInt();
43 else if (key==
"BorderType")
44 borderMode = (rhs[i+1].isChar()) ?
45 BorderType[rhs[i+1].toString()] : rhs[i+1].toInt();
46 else if (key==
"BorderValue")
47 borderValue = rhs[i+1].toScalar();
49 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
53 Mat src(rhs[0].toMat()),
54 map1(rhs[1].toMat(rhs[1].isInt16() ? CV_16S : CV_32F)),
57 map2 = rhs[2].toMat(rhs[2].isUint16() ? CV_16U : CV_32F);
58 remap(src, dst, map1, map2, interpolation, borderMode, borderValue);
const ConstMap< std::string, int > InterpType
Interpolation type map for option processing.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
const ConstMap< std::string, int > BorderType
Border type map for option processing.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.