Open3D Python加载点云RGBD生成彩色点云

本文介绍了如何使用Open3D库读取SUNrgbd数据集中的图像和深度信息,将其转换为RGBDImage,然后创建并显示一个点云,展示了从原始数据到三维可视化的过程。
import open3d as o3d
import numpy as np
import matplotlib.pyplot as plt
import os
import sys

# monkey patches visualization and provides helpers to load geometries
sys.path.append('..')
# import open3d_tutorial as o3dtut
# change to True if you want to interact with the visualization windows
# o3dtut.interactive = not "CI" in os.environ

print("Read SUN dataset")
color_raw = o3d.io.read_image(
    r"D:\sunrgbd\sunrgbd_trainval\image\000001.jpg")
depth_raw = o3d.io.read_image(
    r"D:sunrgbd\sunrgbd_trainval\depth_png\000001.png")
rgbd_image = o3d.geometry.RGBDImage.create_from_sun_format(color_raw, depth_raw)
print(rgbd_image)

# attention, the depth is nonzero, the point will be constructed
rows, columns = np.nonzero(np.asarray(rgbd_image.depth))

plt.subplot(1, 2, 1)
plt.title('SUN grayscale image')
plt.imshow(rgbd_image.color)
plt.subplot(1, 2, 2)
plt.title('SUN depth image')
plt.imshow(rgbd_image.depth)
plt.show()

pcd = o3d.geometry.PointCloud.create_from_rgbd_image(
    rg
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值