将CV Mat对象转换为std :: vector 无循环

问题描述 投票:0回答:1

我有一个RGB CV::Mat对象,我想将其转换为std::vector<Eigen::Vector3d>以用于open3d pointcloud颜色,是否可以无循环地执行此操作?

谢谢。

opencv vector eigen open3d
1个回答
1
投票

容易,只要您走另一条路:

std::vector<Eigen::Vector3d> pixel_data(height * width);
cv::Mat mat = cv::Mat(height, width, CV_64FC3, &(pixel_data[0](0)));
fill_the_matrix_as_you_wish(mat);
© www.soinside.com 2019 - 2024. All rights reserved.