Ask Your Question
0

Convert cv::Vec<double, 10>> to std::vector

asked 2017-04-18 21:28:50 -0600

Nbb gravatar image

Given a data that I get from a matrix with 10 channels

cv::Mat data = cv::Mat(cv::Size(100, 100), CV_64FC(10));
data.at<cv::Vec<double, 10>>(5, 5);

Is there an efficient way to convert this to a std::vector<double> of size 10 ? I could just create a vector of size 10 and initialize it with the data but I would like to know of a more efficient way.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-04-18 21:44:59 -0600

Nbb gravatar image
const double* p = data.ptr<double>(row - offset, col);  
std::vector<double> temp(p, p + 10);
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-04-18 21:28:50 -0600

Seen: 913 times

Last updated: Apr 18 '17