isl-org / isl-org/Open3D

Color Inversion in Visualizer.capture_screen_float_buffer()

Open
#5,197 1 comment 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

I have been trying to take a screenshot from the Open3d Visualizer and then continue with opencv-python.
I noticed that the colors are inverted when I use `capture_screen_float_buffer()`.
`capture_screen_image()` shows the correct colors.

Result of `capture_screen_float_buffer()`:
![Screenshot_cv2](https://user-images.githubusercontent.com/63588974/173623672-6e8328f7-e910-408b-af32-361af92cb23c.png)

Result of `capture_screen_image()`:
![Screenshot_Open3D](https://user-images.githubusercontent.com/63588974/173623674-5769b979-8214-4cb3-951b-e08509bf43a7.png)

### Steps to reproduce the bug

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

eagle = o3d.data.EaglePointCloud()
pcd = o3d.io.read_point_cloud(eagle.path)
pcd.paint_uniform_color([1, 0, 0]) # Red

vis = o3d.visualization.Visualizer()
vis.create_window(width=1920, height=1200, visible=False)
vis.add_geometry(pcd)

vis.capture_screen_image('Screenshot_Open3D.png', do_render=True)

image_o3d = vis.capture_screen_float_buffer(do_render=True)
image_cv2 = (255.0 * np.asarray(image_o3d)).astype(np.uint8)
cv2.imwrite('Screenshot_cv2.png', image_cv2)
```

### Error message

_No response_

### Expected behavior

I expect the same color for both image exports using `capture_screen_float_buffer()` and `capture_screen_image()`, respectively.

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 20.04
- Python version: 3.8.10 (default, Mar 15 2022, 12:22:08) \n[GCC 9.4.0]
- Open3D version: output from python: 0.15.2+429c3fa
- 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.