23 nargchk(nrhs>=4 && (nrhs%2)==0 && nlhs<=2);
30 double aspectRatio = 0;
31 for (
int i=4; i<nrhs; i+=2) {
32 string key(rhs[i].toString());
33 if (key ==
"DistCoeffs")
34 distCoeffs = rhs[i+1].toMat(
CV_64F);
35 else if (key ==
"AspectRatio")
36 aspectRatio = rhs[i+1].toDouble();
39 "Unrecognized option %s", key.
c_str());
47 if (rhs[0].isNumeric()) {
50 projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs,
51 imagePoints, (nlhs>1 ? jacobian :
noArray()), aspectRatio);
52 if (objectPoints.channels() == 1 && objectPoints.cols == 3)
53 imagePoints = imagePoints.
reshape(1,0);
56 else if (rhs[0].isCell()) {
59 projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs,
60 imagePoints, (nlhs>1 ? jacobian :
noArray()), aspectRatio);
struct mxArray_tag mxArray
Forward declaration for mxArray.
Mat reshape(int cn, int rows=0) const
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 projectPoints(InputArray objectPoints, InputArray rvec, InputArray tvec, InputArray cameraMatrix, InputArray distCoeffs, OutputArray imagePoints, OutputArray jacobian=noArray(), double aspectRatio=0)
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.