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;
34 double max_theta = CV_PI;
35 for (
int i=1; i<nrhs; i+=2) {
36 string key(rhs[i].toString());
38 rho = rhs[i+1].toDouble();
39 else if (key==
"Theta")
40 theta = rhs[i+1].toDouble();
41 else if (key==
"Threshold")
42 threshold = rhs[i+1].toInt();
44 srn = rhs[i+1].toDouble();
46 stn = rhs[i+1].toDouble();
47 else if (key==
"MinTheta")
48 min_theta = rhs[i+1].toDouble();
49 else if (key==
"MaxTheta")
50 max_theta = rhs[i+1].toDouble();
52 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
56 Mat image(rhs[0].toMat(CV_8U));
58 HoughLines(image, lines, rho, theta, threshold, srn, stn,
59 min_theta, max_theta);
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.