19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
25 vector<MxArray> rhs(prhs, prhs+nrhs);
26 bool vect_variant = (rhs[1].numel() == 4);
27 nargchk(vect_variant ? ((nrhs%2)==0) : (nrhs>=5 && (nrhs%2)!=0));
30 int borderType = cv::BORDER_DEFAULT;
31 bool isolated =
false;
33 for (
int i=(vect_variant ? 2 : 5); i<nrhs; i+=2) {
34 string key(rhs[i].toString());
35 if (key==
"BorderType")
37 else if (key==
"Isolated")
38 isolated = rhs[i+1].toBool();
39 else if (key==
"Value")
40 value = rhs[i+1].toScalar();
42 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
44 borderType |= (isolated ? cv::BORDER_ISOLATED : 0);
47 Mat src(rhs[0].toMat()), dst;
48 int top, bottom, left, right;
50 vector<int> v(rhs[1].toVector<int>());
59 bottom = rhs[2].toInt();
60 left = rhs[3].toInt();
61 right = rhs[4].toInt();
63 copyMakeBorder(src, dst, top, bottom, left, right, borderType, value);
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
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.