isl-org / isl-org/Open3D

Segmentation fault for o3d.utility.Vector3dVector() constructor

Open
#6,993 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](https://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [x] I have checked the [release documentation](https://www.open3d.org/docs/release/) and the [latest documentation](https://www.open3d.org/docs/latest/) (for `main` branch).

### Describe the issue

I'm trying to visualize a point cloud from a .laz file. I used laspy to extract the pcd points, then used numpy to convert the points into an array. The problem I'm encountering is a segmentation error whenever I try to replace the empty points in the point cloud object with the numpy array. I commented out the converted array and used a simple 3x3 array to see if the o3d.utility.Vector3dVector(pcd_numpy) is taking into too large of a size. Still got the error. I came across a comment saying try to use open3d==0.17.0 and python3.10. Still got the error. I tried installing open3d via pip in conda and I also tried installing via wheel from both the latest and second latest releases.

### Steps to reproduce the bug

```python
#import earthaccess as ea
#import h5py
#import pandas as pd
import laspy
import open3d as o3d
import numpy as np

"""
ea.login()

test_results = ea.search_data(
short_name = 'ATL03',
bounding_box = (33, 38.8, 76, 84),
count = 10
)

files = ea.download(test_results, './data')
"""

# open .h5 file
'''
with h5py.File('./data/ATL03_20181014002445_02350104_006_02.h5') as file:
# list all groups in the file
data = file['gt1l/heights/h_ph']
# print keys for each level
for key in file.keys():
print(key)

# convert to pandas dataframe
df = pd.DataFrame(data)
print(df.head())
'''

with laspy.open('./data/USGS/USGS_LPC_TX_Central_B1_2017_stratmap17_50cm_3097494d3_LAS_2019.laz') as fh:
print('Points from header:', fh.header.point_count)
las = fh.read()

x = las.x[:100]
y = las.y[:100]
z = las.z[:100]

for i in range(5):
print(f"Point {i}: ({x[i]}, {y[i]}, {z[i]})")

#pcd_numpy = np.vstack((las.x, las.y, las.z)).transpose()
pcd_numpy = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 1]])
pcd = o3d.geometry.PointCloud()

pcd = o3d.utility.Vector3dVector(pcd_numpy)
o3d.visualization.draw([pcd], point_size=2)
```

### Error message

Points from header: 27806620
Point 0: (605353.65, 3334862.61, 255.43)
Point 1: (605353.74, 3334862.98, 258.03000000000003)
Point 2: (605353.9, 3334862.83, 258.72)
Point 3: (605353.63, 3334862.5700000003, 258.71)
Point 4: (605353.67, 3334863.14, 251.84)
zsh: segmentation fault /Users/subhamsahoo/Documents/SatCNN/.venv/bin/python

### Expected behavior

I'm expecting to see a viewer pop up showing the point cloud.

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 20.04 / macOS 12.7 / Windows 10 64-bit
- Python version: 3.10
- Open3D version: output from python: 0.17.0
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip and conda
```

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