23 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=5);
29 Mat cameraMatrix = Mat::eye(3, 3,
CV_64F);
30 double distanceThresh = 50.0;
32 for (
int i=3; i<nrhs; i+=2) {
33 string key(rhs[i].toString());
34 if (key ==
"CameraMatrix")
35 cameraMatrix = rhs[i+1].toMat(
CV_64F);
36 else if (key ==
"DistanceThreshold")
37 distanceThresh = rhs[i+1].toDouble();
38 else if (key ==
"Mask")
39 mask = rhs[i+1].toMat(
CV_8U);
42 "Unrecognized option %s", key.
c_str());
47 R, t, triangulatedPoints;
49 if (rhs[1].isNumeric() && rhs[2].isNumeric()) {
52 good =
recoverPose(E, points1, points2, cameraMatrix, R, t,
53 distanceThresh, (nlhs>3 ? mask :
noArray()),
54 (nlhs>4 ? triangulatedPoints :
noArray()));
56 else if (rhs[1].isCell() && rhs[2].isCell()) {
58 points2(rhs[2].toVector<Point2d>());
59 good =
recoverPose(E, points1, points2, cameraMatrix, R, t,
60 distanceThresh, (nlhs>3 ? mask :
noArray()),
61 (nlhs>4 ? triangulatedPoints :
noArray()));
73 plhs[4] =
MxArray(triangulatedPoints);
struct mxArray_tag mxArray
Forward declaration for mxArray.
InputOutputArray noArray()
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Global constant definitions.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
int recoverPose(InputArray E, InputArray points1, InputArray points2, InputArray cameraMatrix, OutputArray R, OutputArray t, InputOutputArray mask=noArray())