19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
22 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=3);
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 double ransacThreshold = 3.0;
29 double confidence = 0.99;
30 for (
int i=2; i<nrhs; i+=2) {
31 string key(rhs[i].toString());
32 if (key==
"RansacThreshold")
33 ransacThreshold = rhs[i+1].toDouble();
34 else if (key==
"Confidence")
35 confidence = rhs[i+1].toDouble();
37 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
43 if (rhs[0].isNumeric() && rhs[1].isNumeric()) {
44 Mat src(rhs[0].toMat(CV_32F)),
45 dst(rhs[1].toMat(CV_32F));
46 result = estimateAffine3D(src, dst, out,
47 (nlhs>1 ? inliers : noArray()), ransacThreshold, confidence);
49 else if (rhs[0].isCell() && rhs[1].isCell()) {
50 vector<Point3f> src(rhs[0].toVector<Point3f>()),
51 dst(rhs[1].toVector<Point3f>());
52 result = estimateAffine3D(src, dst, out,
53 (nlhs>1 ? inliers : noArray()), ransacThreshold, confidence);
56 mexErrMsgIdAndTxt(
"mexopencv:error",
"Invalid argument");
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.