ocvMxArrayToMat_{DataType}
Convert column major mxArray
to row
major cv::Mat
for generic
matrix
C++ Syntax
#include "opencvmex.hpp"
void
ocvMxArrayToMat_double(const mxArray *in, cv::Mat
&out);
void
ocvMxArrayToMat_single(const mxArray *in, cv::Mat
&out);
void
ocvMxArrayToMat_uint8(const mxArray *in, cv::Mat
&out);
void
ocvMxArrayToMat_uint16(const mxArray *in, cv::Mat
&out);
void
ocvMxArrayToMat_uint32(const mxArray *in, cv::Mat
&out);
void
ocvMxArrayToMat_int8(const mxArray *in, cv::Mat
&out);
void
ocvMxArrayToMat_int16(const mxArray *in, cv::Mat
&out);
void
ocvMxArrayToMat_int32(const mxArray *in, cv::Mat
&out);
void
ocvMxArrayToMat_bool(const mxArray *in, cv::Mat
&out);
cv::Ptr<cv::Mat>
ocvMxArrayToMat_double(const mxArray *in, const
bool copyData = true);
cv::Ptr<cv::Mat>
ocvMxArrayToMat_single(const mxArray *in, const
bool copyData = true);
cv::Ptr<cv::Mat> ocvMxArrayToMat_uint8(const
mxArray *in, const bool copyData =
true);
cv::Ptr<cv::Mat>
ocvMxArrayToMat_uint16(const mxArray *in, const
bool copyData = true);
cv::Ptr<cv::Mat>
ocvMxArrayToMat_uint32(const mxArray *in, const
bool copyData = true);
cv::Ptr<cv::Mat> ocvMxArrayToMat_int8(const
mxArray *in, const bool copyData =
true);
cv::Ptr<cv::Mat>
ocvMxArrayToMat_int16(const mxArray *in, const
bool copyData = true);
cv::Ptr<cv::Mat> ocvMxArrayToMat_int32(const
mxArray *in, const bool copyData =
true);
cv::Ptr<cv::Mat>
ocvMxArrayToMat_uint8(const mxArray *in, const
bool copyData = true);
Arguments
in
Pointer to a MATLAB® struct,
mxArray
, having column major data. The data can be n-channel matrices. Supported data types:real_T
(double
)uint8_T
(uint8
)uint32_T
(uint32
)int16_T
(int16
)real32_T
(single
)uint16_T
(uint16
)int8_T
(int8
)int32_T
(int32
)copyData
Boolean flag to copy data from
mxArray
to theMat
object.true
(default) — The function transposes and interleaves (for RGB images) column majormxArray
data into a row majorcv::Mat
object.false
— No data copies from themxArray
to theMat
object. The function creates a newMat
wrapper and uses it to point to themxArray
data. Because OpenCV is row-based and MATLAB is column-based, the columns of themxArray
become the rows of theMat
object. If the image is 2-D, thencopyData
isfalse
.
out
Reference to OpenCV
cv::Mat
with row major data.
Returns
The functions that set copyData
return an
OpenCV smart pointer (cv::Ptr
) to
a cv::Mat
object.
Description
The ocvMxArrayToMat_{DataType}
function
applies to two C++ implementations. One set returns
void
and the other set returns
an OpenCV smart pointer. The functions that return
void
reallocate memory for the
cv::Mat
if needed.
The ocvMxArrayToMat_{DataType}
transposes
and interleaves column major mxArray
data into row major
cv::Mat
. This matrix conversion
is a generic routine for any number of
channels.
See Also
mxArray
, ocvMxArrayToImage_{DataType}
,
ocvMxArrayFromMat_{DataType}
, C Matrix API, Write C Functions Callable from MATLAB (MEX Files)
Version History
Introduced in R2015a