19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
22 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
25 vector<MxArray> rhs(prhs, prhs+nrhs);
30 int flags = cv::INTER_LINEAR;
31 bool warp_inverse =
false;
32 int borderMode = cv::BORDER_CONSTANT;
34 for (
int i=2; i<nrhs; i+=2) {
35 string key(rhs[i].toString());
37 dst = rhs[i+1].toMat();
38 else if (key==
"DSize")
39 dsize = rhs[i+1].toSize();
40 else if (key==
"Interpolation")
42 else if (key==
"WarpInverse")
43 warp_inverse = rhs[i+1].toBool();
44 else if (key==
"BorderType")
46 else if (key==
"BorderValue")
47 borderValue = rhs[i+1].toScalar();
49 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
51 flags |= (warp_inverse ? cv::WARP_INVERSE_MAP : 0);
56 Mat src(rhs[0].toMat()),
57 M(rhs[1].toMat(CV_64F));
58 warpPerspective(src, dst, M, dsize, flags, borderMode, borderValue);
const ConstMap< std::string, int > InterpType
Interpolation type map for option processing.
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.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.