23 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
30 bool L2gradient =
false;
31 for (
int i=2; i<nrhs; i+=2) {
32 string key(rhs[i].toString());
33 if (key ==
"ApertureSize")
34 apertureSize = rhs[i+1].toInt();
35 else if (key ==
"L2Gradient")
36 L2gradient = rhs[i+1].toBool();
39 "Unrecognized option %s", key.
c_str());
42 double threshold1 = 0, threshold2 = 0;
43 if (rhs[1].numel() == 2) {
44 Scalar s(rhs[1].toScalar());
49 threshold2 = rhs[1].toDouble();
50 threshold1 = 0.4 * threshold2;
56 Canny(image, edges, threshold1, threshold2, apertureSize, L2gradient);
struct mxArray_tag mxArray
Forward declaration for mxArray.
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...
void Canny(InputArray image, OutputArray edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false)
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Global constant definitions.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.