把现有的ICP配准算法集中封装了一下, 并且集成了配准之前和之后常用的操作, 适配了 numpy 数组。
只需要用 open3d 读取两帧点云数据后,用这样的方式调用函数即可, icp2l_v2([pcd1, pcd2])
import open3d as o3d
import numpy as np
import copy
# we: 394467238
def draw_registration_result(source, target, transformation, use_np=False):
if use_np:
source_temp = o3d.geometry.PointCloud()
target_temp = o3d.geometry.PointCloud()
source_temp.points = o3d.utility.Vector3dVector(source)
target_temp.points = o3d.utility.Vector3dVector(target)
else:
source_temp = copy.deepcopy(source)
target_temp = copy.deepcopy(target)
source_temp.paint_uniform_color([1, 0.706, 0])
target_temp.paint_uniform_color([0, 0.651, 0.929])
source_temp.transform(transformation)
o3d.visualization.draw_geometries([source_temp, target_temp],
zoom=0.44