‘open3d.open3d.geometry.PointCloud‘ object has no attribute ‘voxel_down_sample‘

scene_cloud = open3d.geometry.PointCloud()

scene_cloud.points = open3d.utility.Vector3dVector(scene_points)

scene_cloud = scene_cloud.voxel_down_sample(voxel_size)

执行上面代码第三句报错,出现了下面这个错误:

AttributeError: 'open3d.open3d.geometry.PointCloud' object has no attribute 'voxel_down_sample'

我chatgpt后,给我说:

从Open3D 0.10.0版本开始,点云的体素下采样方法名称从voxel_down_sample更改为voxel_down_sample_by_voxel_size

我心想我的版本是0.13.0,那改成这个新的方法就行了吧:

scene_cloud = scene_cloud.voxel_down_sample_by_voxel_size(voxel_size)

 结果问题还是原来的问题,也没有这个属性:AttributeError: 'open3d.open3d.geometry.PointCloud' object has no attribute 'voxel_down_sample_by_voxel_size'

我最终的解决方法是:

scene_cloud = open3d.geometry.PointCloud()

scene_cloud.points = open3d.utility.Vector3dVector(scene_points)

# 把这行注释掉不要了
scene_cloud = scene_cloud.voxel_down_sample(voxel_size)
# 改成了这行, 也就是说open3d.gemetry有这个方法,open3d.geometry.PointCloud()没有?
scene_cloud = open3d.geometry.voxel_down_sample(scene_cloud, voxel_size)

你可能感兴趣的:(python,vscode,sublime,text,visual,studio,AI,深度学习,点云)