Open3D Image 转 OpenCV Mat
cv::Mat o3d_cv(const geometry::Image& A) {
int type = A.num_of_channels_ == 1 ? CV_16UC1 : CV_8UC3;//depth, otherwise color
return cv::Mat(A.height_, A.width_, type, (void*)A.data_.data());
}
OpenCV Mat 转 Open3D Image
geometry::Image o3d_cv(const cv::Mat& A) {
geometry::Image B;
int bytes_per_channel = (A.depth() / 2 + 1);//refer to the fuction depth
B.Prepare(A.cols, A.rows, A.channels(), bytes_per_channel);
std::memcpy(B.data_.data(), A.data, A.total() * A.channels() * bytes_per_channel);
return B;
}
对Open3D RGBD影像下采样四倍
std::shared_ptr
for (int j = 0; j < 2; j++) {
cv::Mat color = o3d_cv(rgbd->color_);
cv::resize(color, color, cv::Size(color.cols / 2, color.rows / 2));
rgbd = make_shared
if (j == 0)continue;
cv::imshow("color image", color);
cv::waitKey(1);
————————————————
版权声明:本文为CSDN博主「断、舍、离」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/h1063135843/article/details/114288287