9 #include "opencv2/ximgproc.hpp" 21 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
24 nargchk(nrhs>=1 && (nrhs%2)==1 && nlhs<=1);
27 vector<MxArray> rhs(prhs, prhs+nrhs);
31 double sigmaColor = 25.0;
32 double sigmaSpace = 3.0;
34 int borderType = cv::BORDER_DEFAULT;
35 for (
int i=1; i<nrhs; i+=2) {
36 string key(rhs[i].toString());
37 if (key ==
"Diameter")
39 else if (key ==
"SigmaColor")
40 sigmaColor = rhs[i+1].toDouble();
41 else if (key ==
"SigmaSpace")
42 sigmaSpace = rhs[i+1].toDouble();
43 else if (key ==
"NumIter")
44 numOfIter = rhs[i+1].toInt();
45 else if (key ==
"BorderType")
48 mexErrMsgIdAndTxt(
"mexopencv:error",
49 "Unrecognized option %s", key.c_str());
53 Mat src(rhs[0].toMat(rhs[0].isUint8() ? CV_8U : CV_32F)),
55 rollingGuidanceFilter(src, dst,
56 d, sigmaColor, sigmaSpace, numOfIter, borderType);
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.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Global constant definitions.