isl-org / isl-org/Open3D

Wrong point cloud color when using RGBA images

Open
#5,788 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### Describe the issue

The point cloud has wrong colors when using source RGBA images depending on the alpha value. I don't know if the problem is linked to the point cloud creation or just to the visualization. This problem doesn't happen if the source image has just 3 channels.

This is the point cloud if using the RGB image:
![image](https://user-images.githubusercontent.com/38183728/207402478-af72d10a-6f1d-4796-8318-234cfac34ca0.png)
This is the point cloud if using RGBA image with `ALPHA_VALUE=0`:
![image](https://user-images.githubusercontent.com/38183728/207402965-96415bd5-6e89-4dd9-9aba-549534784fea.png)
This is the point cloud if using RGBA image with `ALPHA_VALUE=100`:
![image](https://user-images.githubusercontent.com/38183728/207403094-841f6c96-bea3-4f58-bee4-c263541b1521.png)
This is the point cloud if using RGBA image with `ALPHA_VALUE=255`:
![image](https://user-images.githubusercontent.com/38183728/207403166-5f779af9-7bb7-4f4f-9dea-18801be2e4fc.png)

### Steps to reproduce the bug

```python
import open3d as o3d
import numpy as np

np.random.seed(0)

ALPHA_VALUE = 0

rgb = (np.random.rand(512, 512, 3) * 255).astype(np.uint8)
alpha = np.full((512, 512, 1), fill_value=ALPHA_VALUE, dtype=np.uint8)
image = np.concatenate([rgb, alpha], axis=2)
depth = np.ones((512, 512), dtype=np.float32)
image_o3d = o3d.geometry.Image(image)
depth_o3d = o3d.geometry.Image(depth)
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(
image_o3d,
depth_o3d,
convert_rgb_to_intensity=False,
depth_scale=1,
depth_trunc=1000,
)
pc = o3d.geometry.PointCloud.create_from_rgbd_image(
rgbd_image, o3d.camera.PinholeCameraIntrinsic()
)
o3d.visualization.draw_geometries([pc])
```

### Error message

_No response_

### Expected behavior

The point cloud should have the same color as the source image.

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 20.04
- Python version: Python 3.8.10
- Open3D version: 0.16.0
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
```

### Additional information

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.