4 Open3D学习笔记——生成RGBD&pcd

读取color和depth图像,先生成RGBD,然后读取相机参数,生成pcd点云

import open3d as o3d 
import matplotlib.pyplot as plt 

color = o3d.io.read_image("/home/jhon/Apps/Open3D/examples/TestData/RGBD/color/00000.jpg")
depth = o3d.io.read_image("/home/jhon/Apps/Open3D/examples/TestData/RGBD/depth/00000.png")
rgbd_img = o3d.geometry.create_rgbd_image_from_color_and_depth(color,depth)
pcd = o3d.geometry.create_point_cloud_from_rgbd_image(
    rgbd_img,o3d.camera.PinholeCameraIntrinsic(
        o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault))
#将图像上下翻转
pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])


plt.subplot(1,2,1)
plt.imshow(rgbd_img.color)
plt.title("color")
plt.subplot(1,2,2)
plt.imshow(rgbd_img.depth)
plt.title("depth")
plt.show()
o3d.visualization.draw_geometries([pcd])
print(rgbd_img)

注:

 rgb 图像是8UC3的彩色图像 ,depth 是16UC1的单通道图像,且以米为单位的深度值表示

 

你可能感兴趣的:(Open3D)