19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 Mat mtx(rhs[1].toMat(CV_64F));
29 if (rhs[0].isNumeric()) {
30 Mat src(rhs[0].toMat(rhs[0].isSingle() ? CV_32F : CV_64F)), dst;
31 bool cn1 = (src.channels() == 1 && (src.cols == 2 || src.cols == 3));
32 if (cn1) src = src.reshape(src.cols, 0);
33 perspectiveTransform(src, dst, mtx);
34 if (cn1) dst = dst.reshape(1, 0);
37 else if (rhs[0].isCell() && !rhs[0].isEmpty()) {
38 mwSize n = rhs[0].at<
MxArray>(0).numel();
40 vector<Point2f> src(rhs[0].toVector<Point2f>()), dst;
41 perspectiveTransform(src, dst, mtx);
45 vector<Point3f> src(rhs[0].toVector<Point3f>()), dst;
46 perspectiveTransform(src, dst, mtx);
50 mexErrMsgIdAndTxt(
"mexopencv:error",
"Invalid input");
53 mexErrMsgIdAndTxt(
"mexopencv:error",
"Invalid input");
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.