25 nargchk(nrhs>=5 && (nrhs%2)==1 && nlhs<=8);
31 Mat cameraMatrix, distCoeffs;
33 TermCriteria criteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON);
34 for (
int i=5; i<nrhs; i+=2) {
35 string key(rhs[i].toString());
36 if (key ==
"CameraMatrix")
37 cameraMatrix = rhs[i+1].toMat(
CV_64F);
38 else if (key ==
"DistCoeffs")
39 distCoeffs = rhs[i+1].toMat(
CV_64F);
40 else if (key ==
"UseIntrinsicGuess")
42 else if (key ==
"FixPrincipalPoint")
44 else if (key ==
"FixFocalLength")
46 else if (key ==
"FixAspectRatio")
48 else if (key ==
"ZeroTangentDist")
50 else if (key ==
"FixTangentDist")
52 else if (key ==
"FixK1")
54 else if (key ==
"FixK2")
56 else if (key ==
"FixK3")
58 else if (key ==
"FixK4")
60 else if (key ==
"FixK5")
62 else if (key ==
"FixK6")
64 else if (key ==
"RationalModel")
66 else if (key ==
"ThinPrismModel")
68 else if (key ==
"FixS1S2S3S4")
70 else if (key ==
"TiltedModel")
72 else if (key ==
"FixTauXTauY")
74 else if (key ==
"UseLU")
76 else if (key ==
"UseQR")
78 else if (key ==
"Criteria")
79 criteria = rhs[i+1].toTermCriteria();
82 "Unrecognized option %s", key.
c_str());
88 counter(rhs[2].toVector<int>());
90 Size imageSize(rhs[4].toSize());
92 Mat stdDeviationsIntrinsics, stdDeviationsExtrinsics, perViewErrors;
94 counter, board, imageSize, cameraMatrix, distCoeffs,
97 (nlhs>5 ? stdDeviationsIntrinsics :
noArray()),
98 (nlhs>6 ? stdDeviationsExtrinsics :
noArray()),
99 (nlhs>7 ? perViewErrors :
noArray()),
101 plhs[0] =
MxArray(cameraMatrix);
111 plhs[5] =
MxArray(stdDeviationsIntrinsics);
113 plhs[6] =
MxArray(stdDeviationsExtrinsics);
115 plhs[7] =
MxArray(perViewErrors);
CALIB_FIX_PRINCIPAL_POINT
CALIB_USE_INTRINSIC_GUESS
struct mxArray_tag mxArray
Forward declaration for mxArray.
Common definitions for the aruco module.
cv::Ptr< cv::aruco::Board > MxArrayToBoard(const MxArray &arr)
Convert MxArray to cv::Ptr<cv::aruco::Board>
InputOutputArray noArray()
#define UPDATE_FLAG(NUM, TF, BIT)
set or clear a bit in flag depending on bool value
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.
double calibrateCameraAruco(InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr< Board > &board, Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs, OutputArrayOfArrays rvecs, OutputArrayOfArrays tvecs, OutputArray stdDeviationsIntrinsics, OutputArray stdDeviationsExtrinsics, OutputArray perViewErrors, int flags=0, TermCriteria criteria=TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON))