isl-org / isl-org/Open3D

Image constructor does not take care of non-contiguous input

Open
#4,792 1 comment 0 reactions 0 assignees View on GitHub
bug geometry legacy (Open3D 0.x API)
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

`o3d.geometry.Image`'s constructor assumes contiguous input.

When the input is non-contiguous, there is no warning and the data can be invalid.

### Steps to reproduce the bug

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

if __name__ == '__main__':
np_image = np.array([[0, 1, 2],
[3, 4, 5]], dtype=np.uint8)
np_image = np.flipud(np_image)
o3_image = o3d.geometry.Image(np_image)

print("numpy image:\n", np_image)
print("open3d image:\n", np.asarray(o3_image))
```

### Error message

```
numpy image:
[[3 4 5]
[0 1 2]]
open3d image:
[[3 4 5]
[0 0 0]]
```

### Expected behavior

Expect the Open3D result to match numpy.

```
numpy image:
[[3 4 5]
[0 1 2]]
open3d image:
[[3 4 5]
[0 1 2]]
```

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 20.04
- Python version: Python 3.8
- Open3D version: 0.14.1
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
- Compiler version (if built from source): N/A
```

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