OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How can I remove points that do not belong to a shared surface within a pointcloud?

  • Thread starter Thread starter GioM
  • Start date Start date
G

GioM

Guest
My program finds points along the bottom surface of a 3D object. The objects are of a unique shape. I am able to get the points on the bottom surface, but some extraneous points remain that are clearly not part of the bottom surface. How to remove or ignore them?

Using the Open3D library in Python 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.

Code:
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])

Under the red line are the points along the bottom surface of the object, the points above the red line are not part of the bottom surface. The red sphere denotes the centroid of the object.

Point cloud. STL model.

Front view: enter image description here

Side view: enter image description here

Top view (notice the continuous surface under the random spurts of points above it): enter image description here

Underside: enter image description here
<p>My program finds points along the bottom surface of a 3D object. The objects are of a unique shape. I am able to get the points on the bottom surface, but some extraneous points remain that are clearly not part of the bottom surface. How to remove or ignore them?</p>
<p>Using the Open3D library in Python 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.</p>
<pre><code>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])
</code></pre>
<p>Under the red line are the points along the bottom surface of the object, the points above the red line are not part of the bottom surface. The red sphere denotes the centroid of the object.</p>
<p><a href="https://drive.google.com/file/d/1_ASE4EzJx3fO3nl-FewtmIDEHvRsw3ZX/view?usp=sharing" rel="nofollow noreferrer">Point cloud</a>. <a href="https://drive.google.com/file/d/1D3nOBXUr0oHnbXbhMLgFd0IMpTwgzSJA/view?usp=sharing" rel="nofollow noreferrer">STL model</a>.</p>
<p>Front view:
<a href="https://i.sstatic.net/8xjomNTK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8xjomNTK.png" alt="enter image description here" /></a></p>
<p>Side view:
<a href="https://i.sstatic.net/9QzmcudK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9QzmcudK.png" alt="enter image description here" /></a></p>
<p>Top view (notice the continuous surface under the random spurts of points above it):
<a href="https://i.sstatic.net/M1cjrBpB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/M1cjrBpB.png" alt="enter image description here" /></a></p>
<p>Underside:
<a href="https://i.sstatic.net/7tsGQceK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7tsGQceK.png" alt="enter image description here" /></a></p>
 

Latest posts

Top