How to turn a cv::Mat into ipcMatrix<ipcRGB>?

Asked

Viewed 47 times

2

  • 1

    Let’s translate the title of the question into English?

1 answer

2


With the help of @karlphillip got come up with a solution:

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);

In this way it is possible to transform a cv::Mat in a ipcMatrix<ipcRGB>.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.