isl-org / Open3D

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

project_pcd to_rgbd_image, empty depth and rgb image #6916

Open kisaragychihaya opened 3 months ago

kisaragychihaya commented 3 months ago

Checklist

Describe the issue

I try to use the project_to_rgbd_image function on my own point cloud like in https://www.open3d.org/docs/release/python_example/geometry/point_cloud/index.html#point-cloud-to-rgbd-py . But got a depth img with all zero value src+data.zip

Steps to reproduce the bug

import open3d as o3d
import numpy as np
import matplotlib.pyplot as plt
print(o3d.__version__)

if __name__ == '__main__':
    # 1. read depth and color image
    pcd = o3d.t.io.read_point_cloud("1.ply")
    h=1080
    w=1920
    f=500
    intr = o3d.open3d.camera.PinholeCameraIntrinsic(w, h, fx=f, fy=f, cx=w/2, cy=h/2)
    rgbd_reproj =  pcd.project_to_rgbd_image(w,
                                            h,
                                            intr.intrinsic_matrix,
                                            depth_scale=1,
                                            depth_max=500.0,)
    print(np.max(rgbd_reproj.depth))
    plt.subplot(1, 2, 1)
    plt.title('chair grayscale image')
    plt.imshow(rgbd_reproj.color)
    plt.subplot(1, 2, 2)
    plt.title('chair depth image')
    plt.imshow(rgbd_reproj.depth)
    plt.show()

Error message

C:\Users\yiku\miniconda3\envs\hgnetv2-deeplabv3\python.exe "C:\Users\yiku\Documents\WeChat Files\wxid_1na96tsg783o21\FileStorage\File\2024-08\新建文件夹\test.py" 0.18.0 0.0 image

Expected behavior

No response

Open3D, Python and System information

- Operating system:  Windows 10 64-bit
- Python version: 3.9.19 (main, Mar 21 2024, 17:21:27) [MSC v.1916 64 bit (AMD64)]
- Open3D version: output from python: 0.18.0
- System architecture: x86 
- Is this a remote workstation?:  no
- How did you install Open3D?: pip
- Compiler version (if built from source):

Additional information

No response

nicolaloi commented 3 months ago

The points of your point cloud are too far away, you have to increase the depth_max argument of project_to_rgbd_image. With a value of 2000 instead of 500 you can already visualize it

bgdys commented 1 month ago

When I fail to read the point cloud, it will also display an empty depth.