I am creating a program that finds points along the bottom surface of a 3D object. The objects I am working with are of a unique shape, and I am fairly new to working with point clouds and with 3D spaces in general.
I am able to successfully get the points on the bottom surface, but some extraneous points remain that are clearly not part of the bottom surface, and I am not sure how to remove or ignore them.
uses primarily the open3D libary in python.
Here is my First Implementation;
It relies on extracting only vertices with negative normals to a point cloud. My reasoning was that points along the underside of the object would only have negative normals
import open3d as o3d
import numpy as np
mesh = o3d.io.read_triangle_mesh("mypath")
mesh.compute_vertex_normals()
vertex_normals = np.asarray(mesh.vertex_normals)
vertices = np.asarray(mesh.vertices)
underside_indices = np.where(vertex_normals[:, 2] < 0)[0]
underside_points = vertices[underside_indices]
underside_point_cloud = o3d.geometry.PointCloud()
underside_point_cloud.points = o3d.utility.Vector3dVector(underside_points)
#Remove outliers
cl, ind = underside_point_cloud.remove_statistical_outlier(nb_neighbors=40, std_ratio=2.0)
clean_underside_point_cloud = underside_point_cloud.select_by_index(ind)
#Compute the centroid of the mesh and Visualize
centroid = mesh.get_center()
centroid_sphere = o3d.geometry.TriangleMesh.create_sphere(radius=1)
centroid_sphere.translate(centroid)
centroid_sphere.paint_uniform_color([1, 0, 0])
#Visualization
o3d.visualization.draw_geometries([clean_underside_point_cloud, centroid_sphere])
and this is my result;
Note: The points under the drawn red line are the points along the bottom surface of the object, while the points above the red line are not part of the bottom surface.
The red sphere denotes the centroid of the object.
Point Cloud Download: Google Drive
STL Model Download: Google Drive
Front View
Side View
Top View (You can notice the continuous surface under the random spurts of points above it)
Underside
Any advice or next steps to take would be much appreicated!