点云配准算法ICP中一个很重要的参数是 threshold
具体可以参考文档:
在查找相关点的时候,如果两个点匹配的距离比threshold小的话,那么这对关联是找不到的,所以这个参数还是很重要的,不然ICP容易失败
所以不是说 threshold越小越好
threshold value for ICP registration open3D python - Stack Overflow
import open3d as o3d
def open3d_registration(src, dst, transfile):
# 读取点云数据
source_pcd = o3d.io.read_point_cloud(src)
target_pcd = o3d.io.read_point_cloud(dst)
# 进行点云配准
threshold = 0.2
trans_init = np.identity(4)
reg_p2p = o3d.pipelines.registration.registration_icp(
source_pcd, target_pcd, threshold, trans_init,
o3d.pipelines.registration.TransformationEstimationPointToPoint(),
o3d.pipelines.registration.ICPConvergenceCriteria(max_iteration=200)
)
np.savetxt(transfile, reg_p2p.transformation)
print("transformation is: \n", reg_p2p.transformation)
return