Enabled syntax highlighting

This commit is contained in:
hbristow 2013-08-28 17:49:20 +10:00
parent 2ac31a87c9
commit eb83a9ed9f

View File

@ -52,14 +52,15 @@ The Matlab bindings come with a set of utilities to help you quickly write your
The first thing you need to learn how to do is write a mex-file with Matlab constructs. Following is a brief example:
// include useful constructs
// this automatically includes opencv core.hpp and mex.h)
#include <opencv2/matlab/bridge.hpp>
using namespace cv;
using namespace std;
```cpp
// include useful constructs
// this automatically includes opencv core.hpp and mex.h)
#include <opencv2/matlab/bridge.hpp>
using namespace cv;
using namespace std;
// define the mex gateway
void mexFunction(int nlhs, mxArray* plhs[],
// define the mex gateway
void mexFunction(int nlhs, mxArray* plhs[],
int nrhs, const mxArray* prhs[]) {
// claim the inputs into scoped management
@ -86,7 +87,8 @@ The first thing you need to learn how to do is write a mex-file with Matlab cons
// allocate an output
Bridge out = required;
plhs[0] = out.toMxArray().releaseOwnership();
}
}
```
There are a couple of important things going on in this example. Firstly, you need to include `<opencv2/matlab/bridge.hpp>` to enable the bridging capabilities. Once you've done this, you get some nice utilities for free. `MxArray` is a class that wraps Matlab's `mxArray*` class in an OOP-style interface. `ArgumentParser` is a class that handles default, optional and named arguments for you, along with multiple possible calling syntaxes. Finally, `Bridge` is a class that allows bidirectional conversions between OpenCV/std and Matlab types.