19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
22 nargchk(nrhs>=1 && (nrhs%2)==1 && nlhs<=1);
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 int maxCorners = 1000;
29 double qualityLevel = 0.01;
30 double minDistance = 2.0;
33 bool useHarrisDetector =
false;
35 for (
int i=1; i<nrhs; i+=2) {
36 string key(rhs[i].toString());
37 if (key==
"MaxCorners")
38 maxCorners = rhs[i+1].toInt();
39 else if (key==
"QualityLevel")
40 qualityLevel = rhs[i+1].toDouble();
41 else if (key==
"MinDistance")
42 minDistance = rhs[i+1].toDouble();
44 mask = rhs[i+1].toMat(CV_8U);
45 else if (key==
"BlockSize")
46 blockSize = rhs[i+1].toInt();
47 else if (key==
"UseHarrisDetector")
48 useHarrisDetector = rhs[i+1].toBool();
50 k = rhs[i+1].toDouble();
52 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
56 Mat image(rhs[0].toMat(rhs[0].isUint8() ? CV_8U : CV_32F));
57 vector<Point2f> corners;
58 goodFeaturesToTrack(image, corners, maxCorners, qualityLevel, minDistance,
59 mask, blockSize, useHarrisDetector, k);
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.