19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
22 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
25 vector<MxArray> rhs(prhs, prhs+nrhs);
29 for (
int i=3; i<nrhs; i+=2) {
30 string key(rhs[i].toString());
32 patchType = (rhs[i+1].isChar()) ?
35 mexErrMsgIdAndTxt(
"mexopencv:error",
"Unrecognized option");
39 Mat image(rhs[0].toMat(rhs[0].isUint8() ? CV_8U : CV_32F)), patch;
40 Size patchSize(rhs[1].toSize());
41 Point2f center(rhs[2].toPoint2f());
42 getRectSubPix(image, patchSize, center, patch, patchType);
const ConstMap< std::string, int > ClassNameMap
Translates class name used in MATLAB to equivalent OpenCV depth.
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Global constant definitions.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.