mexopencv  3.4.1
MEX interface for OpenCV library
bilateralTextureFilter.cpp
Go to the documentation of this file.
1 
8 #include "mexopencv.hpp"
9 #include "opencv2/ximgproc.hpp"
10 using namespace std;
11 using namespace cv;
12 using namespace cv::ximgproc;
13 
21 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
22 {
23  // Check the number of arguments
24  nargchk(nrhs>=1 && (nrhs%2)==1 && nlhs<=1);
25 
26  // Argument vector
27  vector<MxArray> rhs(prhs, prhs+nrhs);
28 
29  // Option processing
30  int fr = 3;
31  int numIter = 1;
32  double sigmaAlpha = -1.0;
33  double sigmaAvg = -1.0;
34  for (int i=1; i<nrhs; i+=2) {
35  string key(rhs[i].toString());
36  if (key == "FR")
37  fr = rhs[i+1].toInt();
38  else if (key == "NumIter")
39  numIter = rhs[i+1].toInt();
40  else if (key == "SigmaAlpha")
41  sigmaAlpha = rhs[i+1].toDouble();
42  else if (key == "SigmaAvg")
43  sigmaAvg = rhs[i+1].toDouble();
44  else
45  mexErrMsgIdAndTxt("mexopencv:error",
46  "Unrecognized option %s", key.c_str());
47  }
48 
49  // Process
50  Mat src(rhs[0].toMat(rhs[0].isUint8() ? CV_8U : CV_32F)),
51  dst;
52  bilateralTextureFilter(src, dst, fr, numIter, sigmaAlpha, sigmaAvg);
53  plhs[0] = MxArray(dst);
54 }
#define CV_8U
void bilateralTextureFilter(InputArray src, OutputArray dst, int fr=3, int numIter=1, double sigmaAlpha=-1., double sigmaAvg=-1.)
STL namespace.
struct mxArray_tag mxArray
Forward declaration for mxArray.
Definition: matrix.h:259
#define CV_32F
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
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...
mxArray object wrapper for data conversion and manipulation.
Definition: MxArray.hpp:123
void nargchk(bool cond)
Alias for input/output arguments number check.
Definition: mexopencv.hpp:181
STL class.
Global constant definitions.
T c_str(T... args)
cv::Mat toMat() const