19 void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs,
const mxArray *prhs[])
22 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=2);
25 vector<MxArray> rhs(prhs, prhs+nrhs);
28 Size region_size(3,3);
29 for (
int i=2; i<nrhs; i+=2) {
30 string key(rhs[i].toString());
31 if (key ==
"RegionSize")
32 region_size = rhs[i+1].toSize();
34 mexErrMsgIdAndTxt(
"mexopencv:error",
35 "Unrecognized option %s",key.c_str());
39 Mat img(rhs[0].toMat(CV_8U));
41 if (rhs[1].isNumeric()) {
42 Mat corners(rhs[1].toMat(CV_32F));
43 success = find4QuadCornerSubpix(img, corners, region_size);
46 else if (rhs[1].isCell()) {
47 vector<Point2f> corners(rhs[1].toVector<Point2f>());
48 success = find4QuadCornerSubpix(img, corners, region_size);
52 mexErrMsgIdAndTxt(
"mexopencv:error",
"Invalid input");
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.