OpenCV
3.4.1
Open Source Computer Vision
|
Type conversion class for converting OpenCV and native C++ types. More...
#include "bridge.hpp"
Static Public Member Functions | |
template<typename Scalar > | |
static matlab::MxArray | FromMat (const cv::Mat &mat) |
Type conversion class for converting OpenCV and native C++ types.
Bridge provides an interface for converting between OpenCV/C++ types to Matlab's mxArray format.
Each type conversion requires three operators: // conversion from ObjectType –> Bridge Bridge& operator=(const ObjectType&); // implicit conversion from Bridge –> ObjectType operator ObjectType(); // explicit conversion from Bridge –> ObjectType ObjectType toObjectType();
The bridging class provides common conversions between OpenCV types, std and stl types to Matlab's mxArray format. By inheriting Bridge, you can add your own custom type conversions.
Because Matlab uses a homogeneous storage type, all operations are provided relative to Matlab's type. That is, Bridge always stores an matlab::MxArray object and converts to and from other object types on demand.
NOTE: for the explicit conversion function, the object name must be in UpperCamelCase, for example: int –> toInt my_object –> MyObject my_Object –> MyObject myObject –> MyObject this is because the binding generator standardises the calling syntax.
Bridge attempts to make as few assumptions as possible, however in some cases where 1-to-1 mappings don't exist, some assumptions are necessary. In particular:
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
unpack an object from Matlab into C++
this function checks whether the given bridge is derived from an object in Matlab. If so, it converts it to a (platform dependent) pointer to the underlying C++ object.
NOTE! This function assumes that the C++ pointer is stored in inst_
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |