32 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=2);
39 double ransacReprojThreshold = 3.0;
41 double confidence = 0.995;
42 for (
int i=2; i<nrhs; i+=2) {
43 string key(rhs[i].toString());
45 method = (rhs[i+1].isChar()) ?
46 Method[rhs[i+1].toString()] : rhs[i+1].toInt();
47 else if (key ==
"RansacReprojThreshold")
48 ransacReprojThreshold = rhs[i+1].toDouble();
49 else if (key ==
"MaxIters")
50 maxIters = rhs[i+1].toInt();
51 else if (key ==
"Confidence")
52 confidence = rhs[i+1].toDouble();
55 "Unrecognized option %s", key.
c_str());
60 if (rhs[0].isNumeric() && rhs[1].isNumeric()) {
63 H =
findHomography(points1, points2, method, ransacReprojThreshold,
64 (nlhs>1 ? mask :
noArray()), maxIters, confidence);
66 else if (rhs[0].isCell() && rhs[1].isCell()) {
68 points2(rhs[1].toVector<Point2f>());
69 H =
findHomography(points1, points2, method, ransacReprojThreshold,
70 (nlhs>1 ? mask :
noArray()), maxIters, confidence);
const ConstMap< string, int > Method
Estimation methods for option processing.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
struct mxArray_tag mxArray
Forward declaration for mxArray.
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.
Mat findHomography(InputArray srcPoints, InputArray dstPoints, int method=0, double ransacReprojThreshold=3, OutputArray mask=noArray(), const int maxIters=2000, const double confidence=0.995)
std::map wrapper with one-line initialization and lookup method.