Enabled syntax highlighting
This commit is contained in:
parent
2ac31a87c9
commit
eb83a9ed9f
@ -52,6 +52,7 @@ 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:
|
The first thing you need to learn how to do is write a mex-file with Matlab constructs. Following is a brief example:
|
||||||
|
|
||||||
|
```cpp
|
||||||
// include useful constructs
|
// include useful constructs
|
||||||
// this automatically includes opencv core.hpp and mex.h)
|
// this automatically includes opencv core.hpp and mex.h)
|
||||||
#include <opencv2/matlab/bridge.hpp>
|
#include <opencv2/matlab/bridge.hpp>
|
||||||
@ -87,6 +88,7 @@ The first thing you need to learn how to do is write a mex-file with Matlab cons
|
|||||||
Bridge out = required;
|
Bridge out = required;
|
||||||
plhs[0] = out.toMxArray().releaseOwnership();
|
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.
|
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.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user