Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The most efficient way is to pass the _buffer pointer to a cv::Mat (link). But beware that you now work with the _buffer data.

The other way is to create a cv::Mat and copy the data to it using memcpy or something. Or you create temporarily a cv::Mat from the _buffer pointer and do a deep copy with cv::Mat::clone() to another one.

The link shows you a lot of possibilities how to construct a cv::Mat.