25 nargchk(nrhs>=5 && (nrhs%2)==1 && nlhs<=4);
31 Mat cameraMatrix, distCoeffs;
32 float minRepDistance = 10.0f;
33 float errorCorrectionRate = 3.0f;
34 bool checkAllOrders =
true;
36 for (
int i=5; i<nrhs; i+=2) {
37 string key(rhs[i].toString());
38 if (key ==
"CameraMatrix")
39 cameraMatrix = rhs[i+1].toMat(
CV_64F);
40 else if (key ==
"DistCoeffs")
41 distCoeffs = rhs[i+1].toMat(
CV_64F);
42 else if (key ==
"MinRepDistance")
43 minRepDistance = rhs[i+1].toFloat();
44 else if (key ==
"ErrorCorrectionRate")
45 errorCorrectionRate = rhs[i+1].toFloat();
46 else if (key ==
"CheckAllOrders")
47 checkAllOrders = rhs[i+1].toBool();
48 else if (key ==
"DetectorParameters")
52 "Unrecognized option %s", key.
c_str());
61 rejectedCorners(MxArrayToVectorVectorPoint<float>(rhs[4]));
65 rejectedCorners, cameraMatrix, distCoeffs, minRepDistance,
66 errorCorrectionRate, checkAllOrders,
67 (nlhs==4) ? recoveredIdxs :
noArray(), params);
68 plhs[0] =
MxArray(detectedCorners);
72 plhs[2] =
MxArray(rejectedCorners);
74 plhs[3] =
MxArray(recoveredIdxs);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
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()
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.
void refineDetectedMarkers(InputArray image, const Ptr< Board > &board, InputOutputArrayOfArrays detectedCorners, InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners, InputArray cameraMatrix=noArray(), InputArray distCoeffs=noArray(), float minRepDistance=10.f, float errorCorrectionRate=3.f, bool checkAllOrders=true, OutputArray recoveredIdxs=noArray(), const Ptr< DetectorParameters > ¶meters=DetectorParameters::create())
Global constant definitions.
cv::Ptr< cv::aruco::DetectorParameters > MxArrayToDetectorParameters(const MxArray &s)
Convert MxArray to cv::Ptr<cv::aruco::DetectorParameters>
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)