Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Convert Mat to 16 bit int

Hi,

I want to convert my 16 bit images from format cv::Mat to 16 bit. Currently, I am using this function

int size = image.total() * image.elemSize(); // number of elements * size of elements
float * bytes = new float[size];  
std::memcpy(bytes, &image.data, size * sizeof(float));
return bytes;

which only allows me to use 8 bit images (format bytes). Do you know a function call to convert cv::Mat to my desired bit format?

Best

ManuKlause