How should I serealize cv::Mat to array?

I try to serialize cv::Mat to array(float).

cv::Mat stores pixel data in BGRBGR…
I want to covert this format into BBB…GGG…RRR.

In generally(I tried),
the way using cv::Mat::at, data and ptr exists.

How could I serealize cv::Mat to array as possible as fast without using other library(e.g. boost)?


Doesn’t seems to be TRT issue.
Request you to please post query related to opencv in below forum: