36 nargchk(nrhs>=1 && (nrhs%2)==1 && nlhs<=2);
43 int templateWindowSize = 4;
44 int searchWindowSize = 16;
45 int blockMatchingStep1 = 2500;
46 int blockMatchingStep2 = 400;
54 for (
int i=1; i<nrhs; i+=2) {
55 string key(rhs[i].toString());
57 basic = rhs[i+1].toMat(rhs[i+1].isUint16() ?
CV_16U :
CV_8U);
59 h = rhs[i+1].toFloat();
60 else if (key ==
"TemplateWindowSize")
61 templateWindowSize = rhs[i+1].toInt();
62 else if (key ==
"SearchWindowSize")
63 searchWindowSize = rhs[i+1].toInt();
64 else if (key ==
"BlockMatchingStep1")
65 blockMatchingStep1 = rhs[i+1].toInt();
66 else if (key ==
"BlockMatchingStep2")
67 blockMatchingStep2 = rhs[i+1].toInt();
68 else if (key ==
"GroupSize")
69 groupSize = rhs[i+1].toInt();
70 else if (key ==
"SlidingStep")
71 slidingStep = rhs[i+1].toInt();
72 else if (key ==
"Beta")
73 beta = rhs[i+1].toFloat();
74 else if (key ==
"NormType")
75 normType =
NormType[rhs[i+1].toString()];
76 else if (key ==
"Step")
77 step = (rhs[i+1].isChar()) ?
79 else if (key ==
"TransformType")
83 "Unrecognized option %s", key.
c_str());
89 if (nlhs > 1 || !basic.
empty()) {
90 bm3dDenoising(src, basic, dst, h, templateWindowSize, searchWindowSize,
91 blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep,
92 beta, normType, step, transformType);
97 bm3dDenoising(src, dst, h, templateWindowSize, searchWindowSize,
98 blockMatchingStep1, blockMatchingStep2, groupSize, slidingStep,
99 beta, normType, step, transformType);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
struct mxArray_tag mxArray
Forward declaration for mxArray.
void bm3dDenoising(InputArray src, InputOutputArray dstStep1, OutputArray dstStep2, float h=1, int templateWindowSize=4, int searchWindowSize=16, int blockMatchingStep1=2500, int blockMatchingStep2=400, int groupSize=8, int slidingStep=1, float beta=2.0f, int normType=cv::NORM_L2, int step=cv::xphoto::BM3D_STEPALL, int transformType=cv::xphoto::HAAR)
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...
const ConstMap< string, int > TransformTypesMap
BM3D transform types for option processing.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
const ConstMap< string, int > Bm3dStepsMap
BM3D algorithm steps for option processing.
Global constant definitions.
std::map wrapper with one-line initialization and lookup method.
const ConstMap< std::string, int > NormType
Norm type map for option processing.