Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Converting Mat img to one dimensional float array in C++ which is in row, column, channel order?

I try to convert a Mat image object to float array which includes the data in row major order. Which means 1D array includes the first row of the image, then the second row etc. At the end, it repeats this for the next image channel.

Here is the silly pseudo description float *A = [first_row_first_channel, second_row_first_channel, ..., first_row_second_channel, ...]

Does Mat img.data provides this ordering or it gives something different? If this is different how can I get the desired orientation ?