isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
10.82k stars 2.24k forks source link

PointCloud.points has no elements and read only #6755

Open szppaks opened 2 months ago

szppaks commented 2 months ago

Checklist

Describe the issue

The points property is readonly, so I have created the point cloud passing a Vector3dVector(nparray) in the constructor. A point cloud has_points() gives True, te get_minimal_oriented_bounding_box() works well, but the points property stores an empty numpy array.

Steps to reproduce the bug

pcd
Out  [2]: PointCloud with 977 points.

pcd.points
Out  [3]: array([], shape=(0, 3), dtype=float64)

pcd.points=np.array([[1,3,3]])
*** AttributeError: 'open3d.cpu.pybind.geometry.PointCloud' object attribute 'points' is read-only

Error message

No response

Expected behavior

No response

Open3D, Python and System information

- Operating system:  Windows 11 64-bit
- Python version: 3.10.11
- Open3D version: 0.18.0
- System architecture: x86 pi
- Is this a remote workstation?: no
- How did you install Open3D?: pip 
- Compiler version (if built from source):

Additional information

No response

saurabheights commented 2 months ago

@szppaks - Use o3d.utility.Vector3dVector. For example:-

import open3d as o3d

pcd = o3d.geometry.PointCloud()
pcd.points=o3d.utility.Vector3dVector(np.array([[1,3,3]]))

See https://www.open3d.org/docs/release/tutorial/geometry/working_with_numpy.html

szppaks commented 2 months ago

import open3d as o3d

pcd = o3d.geometry.PointCloud() pcd.points=o3d.utility.Vector3dVector(np.array([[1,3,3]])) Traceback (most recent call last):

File "C:\Users\b0898\AppData\Local\Temp\ipykernel_9748\1296022844.py", line 4, in <cell line: 4> pcd.points=o3d.utility.Vector3dVector(np.array([[1,3,3]]))

AttributeError: 'open3d.cpu.pybind.geometry.PointCloud' object attribute 'points' is read-only

(I have tried Vector3dVector first, and then simple numpy array, but it does not work - nor set the points neither get the points.)

saurabheights commented 2 months ago

@szppaks Just read again through your original message. This issue is definitely peculiar. Looks like some issue in python bindings not properly mapping points data from C++ to numpy array.