ICP (iterative closest points) 点云配准算法

经典的icp算法(可以参考Chen and Medioni,【2】 and Besl and McKay.【1】),对比于 Kabsch algorithm,ICP在图像和环境配准当中有着更广泛的应用。可以参考:
k-d tree算法,流程大致为:
输入:参考模型点云,实际模型点云,初始估计转换矩阵(可以用于加速配准),结束收敛标准或停止标准
1 参考模型点云和实际模型点云寻找配准
2 根据最小似然值得要求,估计一个4X4的转换矩阵,包含旋转和位移。
(根据上一步的转换模型点云,和参考模型点云对准)
3 根据上一步的转换矩阵,转换实际模型点云
4 迭代上面步骤

下面是一个小栗子,在二维空间内配准模型点云和实际点云(在二维坐标系中,旋转矩阵是一个2X2,平移是个2X1的矩阵–》》【R|T】(shape-> 2X3))
retrieved from: https://blog.csdn.net/tercel_zhang/article/details/79713644

结果如下:

  1. 首先需要得到参考点云中每个点和实际模型点云的关系(点对点的关系),如果两个点相对靠近,我们可以把两个点定义为points_pair。 这边可以参考sklear里面的nearest neighbor模块。里面使用的是K-NN分类算法的思想. 简单的来讲,用待测点周围一定距离的点的种类,来决定待测点的分类。当然实际情况可以加上一定权重(半径,种类…)


retrieved from https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm

class NearestNeighbors(NeighborsBase, KNeighborsMixin,RadiusNeighborsMixin, UnsupervisedMixin):"""Unsupervised learner for implementing neighbor searches.Read more in the :ref:`User Guide <unsupervised_neighbors>`.Parameters----------n_neighbors : int, optional (default = 5)Number of neighbors to use by default for :meth:`kneighbors` queries.radius : float, optional (default = 1.0)Range of parameter space to use by default for :meth:`radius_neighbors`queries.algorithm : {'auto', 'ball_tree', 'kd_tree', 'brute'}, optionalAlgorithm used to compute the nearest neighbors:- 'ball_tree' will use :class:`BallTree`- 'kd_tree' will use :class:`KDTree`- 'brute' will use a brute-force search.- 'auto' will attempt to decide the most appropriate algorithmbased on the values passed to :meth:`fit` method.Note: fitting on sparse input will override the setting ofthis parameter, using brute force.leaf_size : int, optional (default = 30)Leaf size passed to BallTree or KDTree.  This can affect thespeed of the construction and query, as well as the memoryrequired to store the tree.  The optimal value depends on thenature of the problem.metric : string or callable, default 'minkowski'metric to use for distance computation. Any metric from scikit-learnor scipy.spatial.distance can be used.If metric is a callable function, it is called on eachpair of instances (rows) and the resulting value recorded. The callableshould take two arrays as input and return one value indicating thedistance between them. This works for Scipy's metrics, but is lessefficient than passing the metric name as a string.Distance matrices are not supported.Valid values for metric are:- from scikit-learn: ['cityblock', 'cosine', 'euclidean', 'l1', 'l2','manhattan']- from scipy.spatial.distance: ['braycurtis', 'canberra', 'chebyshev','correlation', 'dice', 'hamming', 'jaccard', 'kulsinski','mahalanobis', 'minkowski', 'rogerstanimoto', 'russellrao','seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean','yule']See the documentation for scipy.spatial.distance for details on thesemetrics.p : integer, optional (default = 2)Parameter for the Minkowski metric fromsklearn.metrics.pairwise.pairwise_distances. When p = 1, this isequivalent to using manhattan_distance (l1), and euclidean_distance(l2) for p = 2. For arbitrary p, minkowski_distance (l_p) is used.metric_params : dict, optional (default = None)Additional keyword arguments for the metric function.n_jobs : int or None, optional (default=None)The number of parallel jobs to run for neighbors search.``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.``-1`` means using all processors. See :term:`Glossary <n_jobs>`for more details.Examples-------->>> import numpy as np>>> from sklearn.neighbors import NearestNeighbors>>> samples = [[0, 0, 2], [1, 0, 0], [0, 0, 1]]>>> neigh = NearestNeighbors(2, 0.4)>>> neigh.fit(samples)  #doctest: +ELLIPSISNearestNeighbors(...)>>> neigh.kneighbors([[0, 0, 1.3]], 2, return_distance=False)... #doctest: +ELLIPSISarray([[2, 0]]...)>>> nbrs = neigh.radius_neighbors([[0, 0, 1.3]], 0.4, return_distance=False)>>> np.asarray(nbrs[0][0])array(2)See also--------KNeighborsClassifierRadiusNeighborsClassifierKNeighborsRegressorRadiusNeighborsRegressorBallTreeNotes-----See :ref:`Nearest Neighbors <neighbors>` in the online documentationfor a discussion of the choice of ``algorithm`` and ``leaf_size``.https://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm"""
  1. 在搜集到的point_pair当中,可以用来计算X,Y两个方向的平移量和绕中心的旋转量,也就是之前提到的[R|X] (shape:2X3)的矩阵。具体方法如下:求得参考点云的平均值,和带配准模型点云的平均值,随后利用和差化积求得旋转角度,和X,Y的平移量。
   for pair in point_pairs:(x, y), (xp, yp) = pairx_mean += xy_mean += yxp_mean += xpyp_mean += ypx_mean /= ny_mean /= nxp_mean /= nyp_mean /= ns_x_xp = 0s_y_yp = 0s_x_yp = 0s_y_xp = 0for pair in point_pairs:(x, y), (xp, yp) = pairs_x_xp += (x - x_mean)*(xp - xp_mean)s_y_yp += (y - y_mean)*(yp - yp_mean)s_x_yp += (x - x_mean)*(yp - yp_mean)s_y_xp += (y - y_mean)*(xp - xp_mean)rot_angle = math.atan2(s_x_yp - s_y_xp, s_x_xp + s_y_yp)translation_x = xp_mean - (x_mean*math.cos(rot_angle) - y_mean*math.sin(rot_angle))translation_y = yp_mean - (x_mean*math.sin(rot_angle) + y_mean*math.cos(rot_angle))

实际使用的SDK或API:
Point Clould Libray: https://en.wikipedia.org/wiki/PCL_(Point_Cloud_Library);
VTK;
ITK;
Open3D;

【1】Besl, Paul J.; N.D. McKay (1992). “A Method for Registration of 3-D Shapes”. IEEE Transactions on Pattern Analysis and Machine Intelligence. 14 (2): 239–256. doi:10.1109/34.121791.
【2】Chen, Yang; Gerard Medioni (1991). “Object modelling by registration of multiple range images”. Image Vision Comput. 10 (3): 145–155. doi:10.1016/0262-8856(92)90066-C.

当2D配准准备好后,我们下面可以进行3D点云的配准!!!

PCL ICP算法概述总结相关推荐

  1. ICP算法概述以及使用SVD进行算法推导

    本文转载于B站UP主 摆烂世家的视频ICP算法概述及使用SVD推导(组会录像) 作者:苏浩田 (注:如有侵权,私信我下立马删咯) 1 ICP 算法   三维点云拼接技术在不同场合亦被称为重定位.配准或 ...

  2. 点云匹配和ICP算法概述

    [原文:http://www.cnblogs.com/yhlx125/p/4955337.html] Iterative Closest Point (ICP) [1][2][3] is an alg ...

  3. PCL点云库:ICP算法

    ICP(Iterative Closest Point迭代最近点)算法是一种点集对点集配准方法.在VTK.PCL.MRPT.MeshLab等C++库或软件中都有实现,可以参见维基百科中的ICP Alg ...

  4. PCL学习笔记二:Registration (ICP算法)

    ICP in PCL Registration 点云配准是什么,维基百科上这样介绍: Point cloud registration, is the process of finding a spa ...

  5. 三维点集拟合:平面拟合、RANSAC、ICP算法

    ACM算法分类:http://www.kuqin.com/algorithm/20080229/4071.html;CSDN容易吞图,不过编辑器里面图片还是显示的..... 一. 拟合一个平面     ...

  6. ICP算法进行点云匹配

    [原文:http://www.cnblogs.com/yhlx125/p/5234156.html] 上一篇:http://www.cnblogs.com/yhlx125/p/4924283.html ...

  7. 安装使用python-pcl调用ICP算法|debug

    安装使用python-pcl调用ICP算法|debug 最近需要使用迭代最近点算法计算两帧二维点云数据的转换矩阵TTT,PCL库中自带ICP算法,由于当程序都是用python编写,所以安装python ...

  8. 点云配准2:icp算法在PCL1.10.0上的实现+源码解析

    目录 本文最后实现的配准实例 点云配准系列 准备 程序结构 主程序 1.为什么要降采样 2.体素降采样原理 3.点云更新 icp 配准前的参数设置 icp配准算法内部 对应点对确定(determine ...

  9. PCL ICP使用OMP加速(ICP_OMP)

    最近项目中使用到了pcl库的ICP算法,但是pcl库的ICP算法在点云数量较多时计算速度较慢.ICP算法中频繁的使用了kdtree最近邻搜索,而每次迭代中每个点的最近邻搜索是可以并行计算的,因此想到了 ...

最新文章

  1. 石锤!谷歌排名第一的编程语言,死磕这点,程序员都收益
  2. 【重磅】斯坦福李飞飞最新《注意力与Transformer》总结,84页ppt下载!
  3. python局域网传输文件_Python+pyftpdlib实现局域网文件互传
  4. 导致溢出_1篇文章搞清楚8种JVM内存溢出(OOM)的原因和解决方法
  5. 什么是计算机网络中的主机?
  6. 上传到SAP云平台CloudFoundry上的nodejs应用存储的绝对路径
  7. 看完这个你还不理解右值引用和移动构造 你就可以来咬我(下)
  8. java jndi使用_Java项目中使用JNDI连接数据库
  9. 2020年度电竞营销行业报告
  10. vue vue实例中的data与vue组件中的data()
  11. CentOS linux修改主机名
  12. 蓝桥杯进制转换的一题……
  13. 何宾 单片机原理及应用_stc单片机原理及应用.pdf
  14. VB - 通过vs2010编写vb程序操作word与excel
  15. tga缩略图预览_甜蜜的缩略图预览库
  16. golang json解析
  17. 解决Jmeter CA证书不受信任无法问题(导致代理服务器无法录制脚本)
  18. 第30集丨本来的面目:认识你自己
  19. 麒麟开源堡垒机银行行业设计方案
  20. android 从服务端获取的图片怎么适配不同分屏幕的手机,移动端的适配|切图|标注...

热门文章

  1. Systick寄存器
  2. Ubuntu20.04安装完NVIDIA驱动后重启黑屏,无法进入图形桌面的可能解决方法
  3. DCGAN生成彩色头像
  4. webpack配置与优化
  5. mysql跨版本迁移_不同版本的mysql数据迁移 | 学步园
  6. 第 27、28、29 节 接口、抽象类、SOLID、单元测试、反射
  7. scratch节假日课程:妇女节,为女神绘制一朵玫瑰花吧
  8. 基于容器技术的阿里云区块链优势和实现方法
  9. 什么是用户画像,用户画像的作用是什么?
  10. 微信神坑 - 网页缓存清除解决方案