OpenCV
3.0.0
Open Source Computer Vision
|
A thin wrapper around Matlab's mxArray types. More...
#include "mxarray.hpp"
Public Member Functions | |
MxArray () | |
default constructor More... | |
MxArray (const mxArray *ptr) | |
inheriting constructor More... | |
MxArray (size_t m, size_t n, size_t k, mxClassID id, mxComplexity com=matlab::Traits<>::Real) | |
explicit typed constructor More... | |
MxArray (const MxArray &other) | |
copy constructor More... | |
virtual | ~MxArray () |
destructor More... | |
size_t | channels () const |
std::string | className () const |
size_t | cols () const |
bool | empty () const |
MxArray | field (const std::string &name) |
mxClassID | ID () const |
template<typename Scalar > | |
Scalar * | imag () |
template<typename Scalar > | |
const Scalar * | imag () const |
bool | isCell () const |
bool | isClass (const std::string &name) const |
bool | isComplex () const |
bool | isLogical () const |
bool | isNumeric () const |
bool | isString () const |
bool | isStructure () const |
MxArray & | operator= (const mxArray *ptr) |
MxArray & | operator= (MxArray other) |
copy-and-swap assignment More... | |
template<typename Scalar > | |
Scalar * | real () |
template<typename Scalar > | |
const Scalar * | real () const |
mxArray * | releaseOwnership () |
size_t | rows () const |
template<typename Scalar > | |
Scalar | scalar () const |
size_t | size () const |
std::string | toString () const |
Static Public Member Functions | |
template<typename Scalar > | |
static MxArray | Matrix (size_t m, size_t n) |
explicit matrix constructor More... | |
template<typename ScalarType > | |
static MxArray | Scalar (ScalarType value=0) |
explicit scalar constructor More... | |
template<typename Scalar > | |
static MxArray | Tensor (size_t m, size_t n, size_t k=1) |
explicit tensor constructor More... | |
template<typename Scalar > | |
static MxArray | Vector (size_t m) |
explicit vector constructor More... | |
Friends | |
void | swap (MxArray &first, MxArray &second) |
swap all members of this and other More... | |
A thin wrapper around Matlab's mxArray types.
MxArray provides a thin object oriented wrapper around Matlab's native mxArray type which exposes most of the functionality of the Matlab interface, but in a more C++ manner. MxArray objects are scoped, so you can freely create and destroy them without worrying about memory management. If you wish to pass the underlying mxArray* representation back to Matlab as an lvalue, see the releaseOwnership() method
MxArrays can be directly converted into OpenCV mat objects and std::string objects, since there is a natural mapping between these types. More complex types are mapped through the Bridge which does custom conversions such as MxArray –> cv::Keypoints, etc
|
inline |
default constructor
Construct a valid 0x0 matrix (so all other methods do not need validity checks)
|
inlinevirtual |
destructor
The destructor deallocates any data allocated by mxCreate* methods only if the object is owned
|
inline |
inheriting constructor
Inherit an mxArray from Matlab. Don't claim ownership of the array, just encapsulate it
|
inline |
explicit typed constructor
This constructor explicitly creates an MxArray of the given size and type.
|
inline |
copy constructor
All copies are deep copies. If you have a C++11 compatible compiler, prefer move construction to copy construction
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
explicit matrix constructor
Explicitly construct a matrix of given size and type. Since constructors cannot be explicitly templated, this is a static factory method
|
inline |
copy-and-swap assignment
This assignment operator uses the copy and swap idiom to provide a strong exception guarantee when swapping two objects.
Note in particular that the other MxArray is passed by value, thus invoking the copy constructor which performs a deep copy of the input. The members of this and other are then swapped
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
explicit scalar constructor
Explicitly construct a scalar of given type. Since constructors cannot be explicitly templated, this is a static factory method
|
inline |
|
inline |
|
inlinestatic |
explicit tensor constructor
Explicitly construct a tensor of given size and type. Since constructors cannot be explicitly templated, this is a static factory method
|
inline |
explicit vector constructor
Explicitly construct a vector of given size and type. Since constructors cannot be explicitly templated, this is a static factory method
swap all members of this and other
the swap method is used by the assignment and move constructors to swap the members of two MxArrays, leaving both in destructible states