15 (
"Translation", cv::MOTION_TRANSLATION)
16 (
"Euclidean", cv::MOTION_EUCLIDEAN)
17 (
"Affine", cv::MOTION_AFFINE)
18 (
"Homography", cv::MOTION_HOMOGRAPHY);
28 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
31 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=2);
34 vector<MxArray> rhs(prhs, prhs+nrhs);
37 int motionType = cv::MOTION_AFFINE;
38 TermCriteria criteria(TermCriteria::COUNT+TermCriteria::EPS, 50, 0.001);
41 for (
int i=2; i<nrhs; i+=2) {
42 string key(rhs[i].toString());
43 if (key ==
"MotionType")
44 motionType = MotionTypeMap[rhs[i+1].toString()];
45 else if (key ==
"Criteria")
46 criteria = rhs[i+1].toTermCriteria();
47 else if (key ==
"Mask")
48 inputMask = rhs[i+1].toMat(CV_8U);
49 else if (key ==
"InputWarp")
50 warpMatrix = rhs[i+1].toMat(CV_32F);
52 mexErrMsgIdAndTxt(
"mexopencv:error",
53 "Unrecognized option %s", key.c_str());
57 Mat templateImage(rhs[0].toMat(rhs[0].isUint8() ? CV_8U : CV_32F)),
58 inputImage(rhs[1].toMat(rhs[1].isUint8() ? CV_8U : CV_32F));
59 double rho = findTransformECC(templateImage, inputImage, warpMatrix,
60 motionType, criteria, inputMask);
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.
std::map wrapper with one-line initialization and lookup method.