python - 为什么 Open3D 法线在 x 方向上不正确?
问题描述
我正在计算 Open3D 中点云的法线
使用:
points = np.random.uniform(-1, 1, (10000, 6))
pointcloud = o3d.geometry.PointCloud()
pointcloud.points = o3d.utility.Vector3dVector(points[:, [0, 1, 2]])
pointcloud.colors = o3d.utility.Vector3dVector(points[:, [3, 4, 5]])
pointcloud = o3d.geometry.voxel_down_sample(pointcloud, voxel_size=0.1)
print("Recompute the normal of the downsampled point cloud ...")
# Why are all the normals in the x direction positive?
o3d.geometry.estimate_normals(
pointcloud,
#search_param=o3d.geometry.KDTreeSearchParamKNN(knn=250),
search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=1.0, max_nn=30)
)
print(np.round(np.asarray(pointcloud.normals).min(axis=0), 3))
print(np.round(np.asarray(pointcloud.normals).max(axis=0), 3))
结果是:
[ 0. -1. -1.]
[1. 1. 1.]
为什么法线的所有 x 分量都是正的?
解决方案
一些法线低于表面,解决方案是:
o3d.geometry.orient_normals_to_align_with_direction(
pointcloud,
orientation_reference=np.array([0., 0., 1.])
)
推荐阅读
- c# - 将组合框的值插入 WPF 中的数据库
- python - 运行 python -m pytest tests 找不到包
- javascript - 从另一个反应应用程序重新渲染反应应用程序
- html - 修复以使 CSS 中的过渡平滑(动画搜索栏)
- python - enumerate(zip(*k_fold(dataset, folds))) 是如何工作的?
- java - 上下文初始化期间遇到异常
- javascript - Rabbitmq 根据用户数量动态创建队列
- ajax - 如何在 laravel 8 中创建关系选择选项 ajax
- c# - 获取与命名空间相关的所有程序集名称
- react-native - 更新视图的属性 src 时出错