mexopencv  0.1
mex interface for opencv library
createConcentricSpheresTestSet.cpp
Go to the documentation of this file.
1 
8 #include "mexopencv.hpp"
9 #include "opencv2/ml.hpp"
10 using namespace std;
11 using namespace cv;
12 using namespace cv::ml;
13 
14 //TODO: bug in 3.1.0, fixed in master
15 // https://github.com/Itseez/opencv/pull/5965
16 
24 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
25 {
26  // Check the number of arguments
27  nargchk(nrhs==3 && nlhs<=2);
28 
29  // Argument vector
30  vector<MxArray> rhs(prhs, prhs+nrhs);
31 
32  // Process
33  int num_samples = rhs[0].toInt(),
34  num_features = rhs[1].toInt(),
35  num_classes = rhs[2].toInt();
36  Mat samples, responses;
37  createConcentricSpheresTestSet(num_samples, num_features, num_classes,
38  samples, responses);
39  plhs[0] = MxArray(samples);
40  if (nlhs > 1)
41  plhs[1] = MxArray(responses);
42 }
mxArray object wrapper for data conversion and manipulation.
Definition: MxArray.hpp:123
void nargchk(bool cond)
Alias for input/ouput arguments number check.
Definition: mexopencv.hpp:166
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Global constant definitions.