mexopencv  3.4.1
MEX interface for OpenCV library
rotate.cpp
Go to the documentation of this file.
1 
8 #include "mexopencv.hpp"
9 using namespace std;
10 using namespace cv;
11 
12 namespace {
15  ("90CW", cv::ROTATE_90_CLOCKWISE)
16  ("180", cv::ROTATE_180)
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<=1);
31 
32  // Argument vector
33  vector<MxArray> rhs(prhs, prhs+nrhs);
34 
35  // Process
36  Mat src(rhs[0].toMat()), dst;
37  int rotateCode = RotateMap[rhs[1].toString()];
38  rotate(src, dst, rotateCode);
39  plhs[0] = MxArray(dst);
40 }
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Definition: rotate.cpp:27
const ConstMap< string, int > RotateMap
Rotation codes.
Definition: rotate.cpp:14
STL namespace.
struct mxArray_tag mxArray
Forward declaration for mxArray.
Definition: matrix.h:259
ROTATE_90_COUNTERCLOCKWISE
mxArray object wrapper for data conversion and manipulation.
Definition: MxArray.hpp:123
void nargchk(bool cond)
Alias for input/output arguments number check.
Definition: mexopencv.hpp:181
STL class.
Global constant definitions.
T rotate(T... args)
ROTATE_180
ROTATE_90_CLOCKWISE
std::map wrapper with one-line initialization and lookup method.
Definition: MxArray.hpp:927
cv::Mat toMat() const