Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Initialize Mat with color data

Hello, I'm trying to initialize a Mat with BGR data. I'm getting a strange results.

I do this all the time: Mat image(Size(cols, rows), CV_8UC1, (void*) inputData, Mat::AUTO_STEP);

But when I do it with a color image the output mat is not correct (its offset in all of BGR data, vertical and horizontal dimensions).

Even if I trim the code to:

Mat image2 = Mat(Size(imageIn.cols, imageIn.rows), imageIn.type(), imageIn.data, Mat::AUTO_STEP);

image2 is not imageIn.

imageIn.type() is CV_8UC3.

What am I doing wrong?

Thanks for your help,

Gunter