23 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=8);
29 Mat cameraMatrix, distCoeffs;
31 TermCriteria criteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON);
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 ==
"DistCoeffs")
37 distCoeffs = rhs[i+1].toMat(
CV_64F);
38 else if (key ==
"UseIntrinsicGuess")
40 else if (key ==
"FixPrincipalPoint")
42 else if (key ==
"FixFocalLength")
44 else if (key ==
"FixAspectRatio")
46 else if (key ==
"ZeroTangentDist")
48 else if (key ==
"FixTangentDist")
50 else if (key ==
"FixK1")
52 else if (key ==
"FixK2")
54 else if (key ==
"FixK3")
56 else if (key ==
"FixK4")
58 else if (key ==
"FixK5")
60 else if (key ==
"FixK6")
62 else if (key ==
"RationalModel")
64 else if (key ==
"ThinPrismModel")
66 else if (key ==
"FixS1S2S3S4")
68 else if (key ==
"TiltedModel")
70 else if (key ==
"FixTauXTauY")
72 else if (key ==
"UseLU")
74 else if (key ==
"UseQR")
76 else if (key ==
"Criteria")
77 criteria = rhs[i+1].toTermCriteria();
80 "Unrecognized option %s", key.
c_str());
86 Size imageSize(rhs[2].toSize());
88 Mat stdDeviationsIntrinsics, stdDeviationsExtrinsics, perViewErrors;
90 objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs,
93 (nlhs>5 ? stdDeviationsIntrinsics :
noArray()),
94 (nlhs>6 ? stdDeviationsExtrinsics :
noArray()),
95 (nlhs>7 ? perViewErrors :
noArray()),
97 plhs[0] =
MxArray(cameraMatrix);
107 plhs[5] =
MxArray(stdDeviationsIntrinsics);
109 plhs[6] =
MxArray(stdDeviationsExtrinsics);
111 plhs[7] =
MxArray(perViewErrors);
CALIB_FIX_PRINCIPAL_POINT
CALIB_USE_INTRINSIC_GUESS
struct mxArray_tag mxArray
Forward declaration for mxArray.
double calibrateCamera(InputArrayOfArrays objectPoints, InputArrayOfArrays imagePoints, 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))
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.