mexopencv  0.1
mex interface for opencv library
rotatedRectangleIntersection.cpp
Go to the documentation of this file.
1 
8 #include "mexopencv.hpp"
9 using namespace std;
10 using namespace cv;
11 
12 namespace {
14 const ConstMap<int,string> RectIntersectInvMap = ConstMap<int,string>
15  (cv::INTERSECT_NONE, "None")
16  (cv::INTERSECT_PARTIAL, "Partial")
17  (cv::INTERSECT_FULL, "Full");
18 }
19 
27 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
28 {
29  // Check the number of arguments
30  nargchk(nrhs==2 && nlhs<=2);
31 
32  // Argument vector
33  vector<MxArray> rhs(prhs, prhs+nrhs);
34 
35  // Process
36  RotatedRect rect1(rhs[0].toRotatedRect()),
37  rect2(rhs[1].toRotatedRect());
38  vector<Point2f> intersection;
39  int result = rotatedRectangleIntersection(rect1, rect2, intersection);
40  plhs[0] = MxArray(intersection);
41  if (nlhs > 1)
42  plhs[1] = MxArray(RectIntersectInvMap[result]);
43 }
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
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
Global constant definitions.
std::map wrapper with one-line initialization and lookup method.
Definition: MxArray.hpp:927