发生异常: AttributeError module 'open3d.cpu.pybind.utility' has no attribute 'VectorDouble' File "E:\迅雷下载\serial-port-to-database-master\import open3d as o3d.py", line 14, in <module> point_cloud.point['velocity'] = o3d.utility.VectorDouble(velocity_attr) AttributeError: module 'open3d.cpu.pybind.utility' has no attribute 'VectorDouble'
时间: 2023-12-17 09:02:07 浏览: 330
非常抱歉,我之前给出的代码有误。Open3D中,没有名为`VectorDouble`的属性类型。请改为使用`VectorFloat`来设置速度和散射强度的属性数据类型。以下是修改后的代码:
```python
import numpy as np
import open3d as o3d
data = np.loadtxt('E:/radar_dataset_astyx-main/dataset_astyx_demo/radar_hires1/000000.txt', skiprows=1)
point_cloud = o3d.geometry.PointCloud()
point_cloud.points = o3d.utility.Vector3dVector(data[:, :3])
# 创建一个新的点云属性对象
velocity_attr = o3d.utility.VectorFloat(data[:, 3].tolist())
scatter_attr = o3d.utility.VectorFloat(data[:, 4].tolist())
# 将点云属性作为点的属性添加到点云对象中
point_cloud.point['velocity'] = velocity_attr
point_cloud.point['scatter'] = scatter_attr
o3d.visualization.draw_geometries([point_cloud])
```
这次代码中,我们使用`o3d.utility.VectorFloat`来设置速度和散射强度的属性数据,并将NumPy数组转换为Python列表。
非常抱歉之前的错误造成的困扰,希望这次能满足你的需求!如果你还有其他问题,请随时提问。
阅读全文