isl-org / isl-org/Open3D

Initially-identical ImageWidgets remain identical too long

Open
#4,981 0 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

Updating an ImageWidget can change other ImageWidgets, if their initial pixel data is identical. (This issue has also been observed with a mix of ImageWidget and Open3DScene.set_background().)

### Steps to reproduce the bug

```python
1. Run the below program
2. The three ImageWidgets are green, red, green
3. Click the checkbox, which calls update_image() on the bottom ImageWidget
4. The ImageWidgets are now red, red, red

#!/usr/bin/env python3

import open3d
import numpy as np

app = open3d.visualization.gui.Application.instance
app.initialize()

img1 = np.asarray([[[0, 255, 0]]*64]*64, dtype=np.uint8)
img2 = np.asarray([[[255, 0, 0]]*64]*64, dtype=np.uint8)

window = app.create_window()

imgview1 = open3d.visualization.gui.ImageWidget()
imgview1.update_image(open3d.geometry.Image(img1))

imgview2 = open3d.visualization.gui.ImageWidget()
imgview2.update_image(open3d.geometry.Image(img2))

imgview3 = open3d.visualization.gui.ImageWidget()
imgview3.update_image(open3d.geometry.Image(img1))

check = open3d.visualization.gui.Checkbox("This checkbox updates the bottom ImageWidget")
check.set_on_checked(lambda checked: imgview3.update_image(open3d.geometry.Image(img2 if checked else img1)))

sidebar = open3d.visualization.gui.Vert()
window.add_child(sidebar)
sidebar.add_child(imgview1)
sidebar.add_child(imgview2)
sidebar.add_child(imgview3)
sidebar.add_child(check)

app.run()
```

### Error message

Not applicable, there are no errors

### Expected behavior

The ImageWidgets shuld be green, red, red at step 4; the top one should not be affected by updating a different ImageWidget

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 20.04
- Python version: Python 3.8.10 (the default on 20.04)
- Open3D version: 0.15.2+4265ea2
- System architecture: x86_64 i5-12600K, nvidia RTX 3070 with driver 470
- Is this a remote workstation?: no
- How did you install Open3D?: pip install --pre https://storage.googleapis.com/open3d-releases-master/python-wheels/open3d-0.15.2+4265ea2-cp38-cp38-manylinux_2_27_x86_64.whl
- Compiler version (if built from source): You know that better than me
```

### 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.