15 (
"Scharr", CV_SCHARR);
25 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
28 nargchk(nrhs>=1 && (nrhs%2)==1 && nlhs<=1);
31 vector<MxArray> rhs(prhs, prhs+nrhs);
40 int borderType = cv::BORDER_DEFAULT;
41 for (
int i=1; i<nrhs; i+=2) {
42 string key(rhs[i].toString());
44 ddepth = (rhs[i+1].isChar()) ?
46 else if (key==
"XOrder")
47 dx = rhs[i+1].toInt();
48 else if (key==
"YOrder")
49 dy = rhs[i+1].toInt();
50 else if (key==
"KSize")
51 ksize = (rhs[i+1].isChar()) ?
52 KSizeMap[rhs[i+1].toString()] : rhs[i+1].toInt();
53 else if (key==
"Scale")
54 scale = rhs[i+1].toDouble();
55 else if (key==
"Delta")
56 delta = rhs[i+1].toDouble();
57 else if (key==
"BorderType")
60 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
64 Mat src(rhs[0].toMat()), dst;
65 Sobel(src, dst, ddepth, dx, dy, ksize, scale, delta, borderType);
const ConstMap< std::string, int > ClassNameMap
Translates class name used in MATLAB to equivalent OpenCV depth.
const ConstMap< std::string, int > BorderType
Border type map for option processing.
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.
std::map wrapper with one-line initialization and lookup method.