isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.44k stars 2.3k forks source link

From NUMPY RGBD To o3d.RGBD #5450

Open wangmiaowei opened 2 years ago

wangmiaowei commented 2 years ago

Checklist

My Question

RuntimeError: [Open3D Error] (static std::shared_ptr open3d::geometry::RGBDImage::CreateFromColorAndDepth(const open3d::geometry::Image&, const open3d::geometry::Image&, double, double, bool)) /root/Open3D/cpp/open3d/geometry/RGBDImageFactory.cpp:42: [CreateFromColorAndDepth] Unsupported image format.

    radius_normal = voxel_size * 2
    color_raw = Image.open(path+"/color/0000"+str(i)+".jpg")
    depth_raw = Image.open(path+"/depth/0000"+str(i)+".png")
    color  =255*rgb_transform(color_raw)
    depth = dep_transform(np.asarray(depth_raw),dims)
    color_o3d = o3d.geometry.Image(color.detach().numpy().astype(np.uint8))
    depth_o3d = o3d.geometry.Image((depth.detach().numpy()).astype(np.uint16))
    print('color_o3d.shape: ',(np.asarray(color_o3d)).max())
    rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(color_o3d,depth_o3d)
    pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image, pinhole_camera_intrinsic)
wangmiaowei commented 2 years ago

OK,this problem is solved by myself. I'd want to paste the solution! All the problems come from unsupported formats.The map type and shaped should be converted to the following format: Screenshot from 2022-08-19 11-15-13