Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No point cloud/white screen created for o3d.geometry.PointCloud.create_from_rgbd_image #7139

Open
3 tasks done
pranman11 opened this issue Jan 17, 2025 · 1 comment
Open
3 tasks done
Labels

Comments

@pranman11
Copy link

pranman11 commented Jan 17, 2025

Checklist

My Question

Hello, I've been searching for what I could be doing wrong for a while, but can't get the point cloud creation from rgbd to work. I have captured rgb and depth frames from realsense D455 cameras and stored them as png and now using them to create a point cloud. Below are the details:

`# Function to load RGB and depth images and convert to point cloud
def create_point_cloud(rgb_image_path, depth_image_path, intrinsic):
if not os.path.exists(rgb_image_path) or not os.path.exists(depth_image_path):
print(f"Error")
exit()

color_raw = o3d.io.read_image(rgb_image_path)
color = o3d.geometry.Image(np.array(np.asarray(color_raw)[:, :, :3]).astype('uint8'))
depth = o3d.io.read_image(depth_image_path)

# Convert to numpy array
depth_array = np.array(depth)    
rgb_array = np.array(color)
print(rgb_array.shape, rgb_array.dtype)
print(depth_array.shape, depth_array.dtype)
print(rgb_array[0])
print(depth_array[0])

rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(
    color, depth, depth_scale=1000, convert_rgb_to_intensity=True)
    
plt.subplot(1, 2, 1)
plt.title('RGB Image')
plt.imshow(rgbd_image.color)
plt.subplot(1, 2, 2)
plt.title('Depth Image')
plt.imshow(rgbd_image.depth, cmap='gray')
plt.show()

print("rgbd created")
pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image, intrinsic)
print("pc created")
return pcd

intrinsic = o3d.camera.PinholeCameraIntrinsic(
width=480, height=640, fx=384.0992736816406, fy=383.57464599609375, cx=320.2293395996094, cy=245.76773071289062)`

OUTPUT:

Image

The rgbd images and the pointcloud are created as well but the visualizer displays an empty white screen.

@pranman11 pranman11 changed the title No point cloud created and code exists without error for create_from_rgbd_image No point cloud/white screen created for o3d.geometry.PointCloud.create_from_rgbd_image Jan 17, 2025
@timohl
Copy link
Contributor

timohl commented Jan 17, 2025

Some points that would help if you could provide them:

  • Open3D version
  • Output of your print statements (maybe also print info about the point cloud)
  • Code calling the visualizer

Also, your code markdown is a bit messed up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants