19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 if (rhs[0].isNumeric()) {
30 Mat src(rhs[0].toMat(rhs[0].isSingle() ? CV_32F : CV_64F)), dst;
31 bool cn1 = (src.channels() == 1);
32 convertPointsToHomogeneous(src, dst);
33 if (cn1) dst = dst.reshape(1,0);
36 else if (rhs[0].isCell() && !rhs[0].isEmpty()) {
37 mwSize dim = rhs[0].at<
MxArray>(0).numel();
40 vector<Point2d> src(rhs[0].toVector<Point2d>());
42 convertPointsToHomogeneous(src, dst);
48 vector<Point3d> src(rhs[0].toVector<Point3d>());
50 convertPointsToHomogeneous(src, dst);
55 mexErrMsgIdAndTxt(
"mexopencv:error",
"Invalid input");
58 mexErrMsgIdAndTxt(
"mexopencv:error",
"Invalid input");
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.