I have a point cloud data which originally looks like this:
Now I have implemented the removal of the edge of the recessed area through the following code. The point cloud after removal is like this, the red area is the edge of the deletion
import pyvista as pv
import numpy as np
from sklearn.neighbors import KDTree
from sklearn.cluster import DBSCAN
point_cloud = pv.read('dataset/car_door_part_3.stl')
curvature = point_cloud.curvature()
threshold_curvature = 0.02 # 根据需要调整曲率阈值
edge_indices = np.where(curvature > threshold_curvature)[0]
edge_points = point_cloud.points[edge_indices]
bool_mask = np.ones(point_cloud.n_points, dtype=bool)
bool_mask[edge_indices] = False
filtered_points = point_cloud.points[bool_mask]
filtered_cloud = pv.PolyData(filtered_points)
p = pv.Plotter()
# p.add_mesh(filtered_cloud)
p.add_mesh(point_cloud)
p.show()
I want to delete the points inside the red area through libraries such as python, numpy, and pyvista. I've tried all kinds of methods but can't achieve it, can you help me? Thank you so much
I tried calculating the curvature before, and looked at the changes in the curvature to identify and remove the sunken area. However, if the concave area is relatively smooth, it cannot be successfully identified.
How to remove the points inside the red border using python, numpy and pyvista?