How to transform a cv :: Mat into ipcMatrixipcRGB?

2

Does anyone know if there is an easy way to turn a cv::Mat into ipcMatrix<ipcRGB> ?

    
asked by anonymous 25.11.2014 / 21:25

1 answer

2

With the help of @ karlphillip I was able to reach a solution : p>

cv::cvtColor(mat_input, mat_rgb, cv::COLOR_BGR2RGB);

int sz = mat_rgb.rows * mat_rgb.cols * mat_rgb.channels();
unsigned char* imageBuf = new unsigned char[sz];

memcpy(imageBuf,mat_rgb.data, sz);
ipcMatrix<ipcRGB> input = ipcMatrix<ipcRGB>(mat_rgb.cols, mat_rgb.rows, (ipcRGB*)imageBuf);

This way you can transform a cv::Mat into a ipcMatrix<ipcRGB> .

    
26.11.2014 / 21:01