Main Content

ocvMxArrayFromMat_{DataType}

Convert row major cv::Mat to column major mxArray for generic matrix

C++ Syntax

#include "opencvmex.hpp"
mxArray *ocvMxArrayFromMat_double(const cv::Mat &in);
mxArray *ocvMxArrayFromMat_single(const cv::Mat &in);
mxArray *ocvMxArrayFromMat_uint8(const cv::Mat &in);
mxArray *ocvMxArrayFromMat_uint16(const cv::Mat &in);
mxArray *ocvMxArrayFromMat_uint32(const cv::Mat &in);
mxArray *ocvMxArrayFromMat_int8(const cv::Mat &in);
mxArray *ocvMxArrayFromMat_int16(const cv::Mat &in);
mxArray *ocvMxArrayFromMat_int32(const cv::Mat &in);
mxArray *ocvMxArrayFromMat_bool(const cv::Mat &in);

Arguments

in

Reference to OpenCV cv::Mat with row major data.

Returns

Pointer to a MATLAB® struct, mxArray, having column major data. 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)

Description

The ocvMxArrayFromMat_{DataType} function creates an mxArray from a cv::Mat object. The mxArray contains column major data and cv::Mat contains row major data. This matrix conversion is a generic routine for any number of channels.

Version History

Introduced in R2015a