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);
29 double theta = CV_PI/180;
31 double minLineLength = 0;
32 double maxLineGap = 0;
33 for (
int i=1; i<nrhs; i+=2) {
34 string key(rhs[i].toString());
36 rho = rhs[i+1].toDouble();
37 else if (key==
"Theta")
38 theta = rhs[i+1].toDouble();
39 else if (key==
"Threshold")
40 threshold = rhs[i+1].toInt();
41 else if (key==
"MinLineLength")
42 minLineLength = rhs[i+1].toDouble();
43 else if (key==
"MaxLineGap")
44 maxLineGap = rhs[i+1].toDouble();
46 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
50 Mat image(rhs[0].toMat(CV_8U));
52 HoughLinesP(image, lines, rho, theta, threshold, minLineLength, maxLineGap);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.