19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
22 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 int flags = cv::INTER_LINEAR;
29 bool fillOutliersFlag =
true;
30 bool invMapFlag =
false;
31 for (
int i=3; i<nrhs; i+=2) {
32 string key(rhs[i].toString());
33 if (key ==
"Interpolation")
34 flags = (rhs[i+1].isChar()) ?
35 InterpType[rhs[i+1].toString()] : rhs[i+1].toInt();
36 else if (key ==
"FillOutliers")
37 fillOutliersFlag = rhs[i+1].toBool();
38 else if (key ==
"InverseMap")
39 invMapFlag = rhs[i+1].toBool();
41 mexErrMsgIdAndTxt(
"mexopencv:error",
42 "Unrecognized option %s", key.c_str());
44 flags |= (fillOutliersFlag ? cv::WARP_FILL_OUTLIERS : 0);
45 flags |= (invMapFlag ? cv::WARP_INVERSE_MAP : 0);
48 Mat src(rhs[0].toMat()), dst;
49 Point2f center(rhs[1].toPoint2f());
50 double maxRadius = rhs[2].toDouble();
51 linearPolar(src, dst, center, maxRadius, flags);
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.
Global constant definitions.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.