nickponline
nickponline

Reputation: 25914

Why are Open3D normals incorrect in x-direction?

I am computing normals for a pointcloud in Open3D

Using:

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))

The result is:

[ 0. -1. -1.]
[1. 1. 1.]

Why are all the x components of the normals positive?

Upvotes: 1

Views: 2053

Answers (1)

nickponline
nickponline

Reputation: 25914

Some normals were below the surface, solution was:

o3d.geometry.orient_normals_to_align_with_direction( pointcloud, orientation_reference=np.array([0., 0., 1.]) )

Upvotes: 2

Related Questions