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);
29 for (
int i=2; i<nrhs; i+=2) {
30 string key(rhs[i].toString());
31 if (key==
"WhichImage")
32 whichImage = rhs[i+1].toInt();
34 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
36 if (whichImage!=1 && whichImage!=2)
37 mexErrMsgIdAndTxt(
"mexopencv:error",
"Invalid WhichImage");
40 Mat F(rhs[1].toMat(CV_64F));
41 if (rhs[0].isNumeric()) {
42 Mat points(rhs[0].toMat(rhs[0].isSingle() ? CV_32F : CV_64F)), lines;
43 bool cn1 = (points.channels() == 1 && (points.cols == 2 || points.cols == 3));
44 if (cn1) points = points.reshape(points.cols, 0);
45 computeCorrespondEpilines(points, whichImage, F, lines);
46 if (cn1) lines = lines.reshape(1,0);
49 else if (rhs[0].isCell()) {
50 vector<Point2d> points(rhs[0].toVector<Point2d>());
51 vector<Point3d> lines;
52 computeCorrespondEpilines(points, whichImage, F, lines);
56 mexErrMsgIdAndTxt(
"mexopencv:error",
"Invalid input");
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.