isl-org / isl-org/Open3D

write_point_cloud saves with different precision depening on `write_ascii`

Open
#4,995 3 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

When using `write_point_cloud` and reading that exact file again the coordinates have been altered, specifically rounded. See the example below where the output is:
```
42098
7958
```
The code counts the number of unique x-coords before writing and after reading. This should be the same count. I attached a sample file.

[1000_pos1.xyzrgb.csv](https://github.com/isl-org/Open3D/files/8476516/1000_pos1.xyzrgb.csv)

### Steps to reproduce the bug

```python
import open3d as o3d
import sys
import numpy as np
import pandas as pd

filename = sys.argv[1]

pcd = o3d.io.read_point_cloud(filename=filename, format="xyzrgb", print_progress=True)
# print number of unique x-coords
print(pd.Series(np.array(pcd.points)[:,0]).nunique())
out_filename = filename.replace("xyzrgb.csv", "rgb.pcd")
o3d.io.write_point_cloud(out_filename, pcd)

pcd_read = o3d.io.read_point_cloud(filename=out_filename)
# print number of unique x-coords
print(pd.Series(np.array(pcd_read.points)[:,0]).nunique())
```

### Error message

There is no error message.

### Expected behavior

Same number of unique x-coordinates:
```
42098
42098
```

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 20.04
- Python version: Python 3.9
- Open3D version: output from python: '0.15.2'
- 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.