30 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=3);
38 for (
int i=3; i<nrhs; i+=2) {
39 string key(rhs[i].toString());
40 if (key ==
"DistCoeffs")
41 distCoeffs = rhs[i+1].toMat(
CV_64F);
42 else if (key ==
"Method")
46 "Unrecognized option %s", key.
c_str());
53 if (rhs[0].isNumeric() && rhs[1].isNumeric()) {
56 solutions =
solveP3P(objectPoints, imagePoints, cameraMatrix, distCoeffs,
59 else if (rhs[0].isCell() && rhs[1].isCell()) {
62 solutions =
solveP3P(objectPoints, imagePoints, cameraMatrix, distCoeffs,
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
struct mxArray_tag mxArray
Forward declaration for mxArray.
const ConstMap< string, int > P3PMethod
Method used for solving the pose estimation problem.
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.
std::map wrapper with one-line initialization and lookup method.
int solveP3P(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, int flags)