9 #include "opencv2/xphoto.hpp" 17 (
"Simple", cv::xphoto::WHITE_BALANCE_SIMPLE)
18 (
"GrayWorld", cv::xphoto::WHITE_BALANCE_GRAYWORLD);
28 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
31 nargchk(nrhs>=1 && (nrhs%2)==1 && nlhs<=1);
34 vector<MxArray> rhs(prhs, prhs+nrhs);
37 int algorithmType = cv::xphoto::WHITE_BALANCE_SIMPLE;
38 float inputMin = 0.0f;
39 float inputMax = 255.0f;
40 float outputMin = 0.0f;
41 float outputMax = 255.0f;
42 for (
int i=1; i<nrhs; i+=2) {
43 string key(rhs[i].toString());
45 algorithmType = WhitebalanceTypeMap[rhs[i+1].toString()];
46 else if (key ==
"InputMin")
47 inputMin = rhs[i+1].toFloat();
48 else if (key ==
"InputMax")
49 inputMax = rhs[i+1].toFloat();
50 else if (key ==
"OutputMin")
51 outputMin = rhs[i+1].toFloat();
52 else if (key ==
"OutputMax")
53 outputMax = rhs[i+1].toFloat();
55 mexErrMsgIdAndTxt(
"mexopencv:error",
56 "Unrecognized option %s", key.c_str());
60 Mat src(rhs[0].toMat()),
62 balanceWhite(src, dst, algorithmType,
63 inputMin, inputMax, outputMin, outputMax);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.
std::map wrapper with one-line initialization and lookup method.