Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Fastest way I know is this:

cv::Mat res(100, 100, CV_8UC1);
std::vector<uchar>vec(res.begin<uchar>(), res.end<uchar>());

Fastest way I know is this:

cv::Mat res(100, 100, CV_8UC1);
std::vector<uchar>vec(res.begin<uchar>(), res.end<uchar>());
CV_32FC1);
std::vector<float>vec(res.begin<float>(), res.end<float>());

Fastest way I know is this:

cv::Mat res(100, 100, CV_32FC1);
std::vector<float>vec(res.begin<float>(), res.end<float>());

or if you declare your vec before:

std::vector<float> vec;
cv::Mat res(100, 100, CV_32FC1);
vec.assign(res.begin<float>(), res.end<float>());

Fastest way I know is this:

cv::Mat res(100, 100, res(m, n, CV_32FC1);
std::vector<float>vec(res.begin<float>(), res.end<float>());

or if you declare your vec before:

std::vector<float> vec;
cv::Mat res(100, 100, res(m, n, CV_32FC1);
vec.assign(res.begin<float>(), res.end<float>());