当前位置:网站首页>Point cloud registration -- GICP principle and its application in PCL
Point cloud registration -- GICP principle and its application in PCL
2022-06-12 12:13:00 【xinxiangwangzhi_】
List of articles
summary :gicp Probability information is introduced ( Use covariance matrix ), Put forward icp The first mock exam , It can explain point to point and point to face icp, On the basis of the new model theory , A face to face icp.
Original paper :《Generalized-ICP》
gicp The first mock exam (Generalized-ICP)
In the probability model, it is assumed that there are two point sets in the registration , A ^ = { a i ^ } \hat{A}=\left\{\hat{a_{i}}\right\} A^={ ai^} and B ^ = { b i ^ } \hat{B}=\left\{\hat{b_{i}}\right\} B^={ bi^}, And suppose A A A and B B B Obey separately a i ∼ N ( a i ^ , C i A ) a_{i} \sim \mathcal{N}\left(\hat{a_{i}}, C_{i}^{A}\right) ai∼N(ai^,CiA)and b i ∼ N ( b ^ i , C i B ) b_{i} \sim \mathcal{N}\left(\hat{b}_{i}, C_{i}^{B}\right) bi∼N(b^i,CiB) Normal distribution . { C i A } \left\{C_{i}^{A}\right\} { CiA} and { C i B } \left\{C_{i}^{B}\right\} { CiB} They are the covariance matrix corresponding to the points . We assume that the matching is complete , Suppose the transformation matrix is T ∗ \mathbf{T}^{*} T∗, therefore :
b ^ i = T ∗ a ^ i (1) \hat{b}_{i}=\mathbf{T}^{*} \hat{a}_{i}\tag{1} b^i=T∗a^i(1)
For transformation matrix , T \mathbf{T} T , Define the amount of error $ d_{i}^{(\mathbf{T})}= b_{i}-\mathbf{T} a_{i} $, Because of the assumption $ a_{i} $ and $ b_{i} $ It follows a normal distribution (NDT It is also assumed that the distribution is normal ), therefore d i ( T ∗ ) d_{i}^{\left(\mathrm{T}^{*}\right)} di(T∗) It also follows a normal distribution :
d i ( T ∗ ) ∼ N ( b ^ i − ( T ∗ ) a ^ i , C i B + ( T ∗ ) C i A ( T ∗ ) T ) = N ( 0 , C i B + ( T ∗ ) C i A ( T ∗ ) T ) (2) \begin{aligned} d_{i}^{\left(\mathbf{T}^{*}\right)} & \sim \mathcal{N}\left(\hat{b}_{i}-\left(\mathbf{T}^{*}\right) \hat{a}_{i}, C_{i}^{B}+\left(\mathbf{T}^{*}\right) C_{i}^{A}\left(\mathbf{T}^{*}\right)^{T}\right) \\ &=\mathcal{N}\left(0, C_{i}^{B}+\left(\mathbf{T}^{*}\right) C_{i}^{A}\left(\mathbf{T}^{*}\right)^{T}\right) \end{aligned}\tag{2} di(T∗)∼N(b^i−(T∗)a^i,CiB+(T∗)CiA(T∗)T)=N(0,CiB+(T∗)CiA(T∗)T)(2)
Using maximum likelihood estimation ( MLE) Calculation T \mathbf{T} T :
T = argmax T ∏ i p ( d i ( T ) ) = argmax T ∑ i log ( p ( d i ( T ) ) ) (3) \mathbf{T}=\underset{\mathbf{T}}{\operatorname{argmax}} \prod_{i} p\left(d_{i}^{(\mathrm{T})}\right)=\underset{\mathbf{T}}{\operatorname{argmax}} \sum_{i} \log \left(p\left(d_{i}^{(\mathrm{T})}\right)\right)\tag{3} T=Targmaxi∏p(di(T))=Targmaxi∑log(p(di(T)))(3)
Further simplified to :( Here we derive from the maximum likelihood estimation , The specific process needs to be studied )
T = argmin T ∑ i d i ( T ) T ( C i B + T C i A T T ) − 1 d i ( T ) (4) \mathbf{T}=\underset{\mathrm{T}}{\operatorname{argmin}} \sum_{i} d_{i}^{(\mathbf{T})^{T}}\left(C_{i}^{B}+\mathbf{T} C_{i}^{A} \mathbf{T}^{T}\right)^{-1} d_{i}^{(\mathbf{T})}\tag{4} T=Targmini∑di(T)T(CiB+TCiATT)−1di(T)(4)
When :
C i B = I C i A = 0 (5) C_{i}^{B} = I \\ C_{i}^{A} = 0\tag{5} CiB=ICiA=0(5)
Get the standard ICP:
T = argmin T ∑ i d i ( T ) T d i ( T ) = argmin T ∑ i ∥ d i ( T ) ∥ 2 (6) \begin{aligned} \mathbf{T} &=\underset{\mathbf{T}}{\operatorname{argmin}} \sum_{i} d_{i}^{(\mathrm{T})^{T}} d_{i}^{(\mathrm{T})} \\ &=\underset{\mathbf{T}}{\operatorname{argmin}} \sum_{i}\left\|d_{i}^{(\mathrm{T})}\right\|^{2} \end{aligned}\tag{6} T=Targmini∑di(T)Tdi(T)=Targmini∑∥∥∥di(T)∥∥∥2(6)
When :
C i B = P i − 1 C i A = 0 (7) \begin{aligned} C_{i}^{B} &=\mathbf{P}_{\mathbf{i}}^{-1} \\ C_{i}^{A} &=0 \end{aligned}\tag{7} CiBCiA=Pi−1=0(7)
Get point to face ICP:
T = argmin T { ∑ i ∥ P i ⋅ d i ∥ 2 } (8) \mathbf{T}=\underset{\mathbf{T}}{\operatorname{argmin}}\left\{\sum_{i}\left\|\mathbf{P}_{\mathbf{i}} \cdot d_{i}\right\|^{2}\right\}\tag{8} T=Targmin{ i∑∥Pi⋅di∥2}(8)
plane to plane ICP(gicp: Relative to point-to-point and point-to-face, the probability model is added ( Covariance matrix ))
The point to plane algorithm is , Suppose that the point cloud has planar features , This means that 3D Spatial processing sampling 2D manifold .
Because the real world surface is at least piecewise differentiable , We can assume that our data set is locally planar . Besides , Because we sample manifolds from two different angles , Therefore, exactly the same points are usually not sampled ( namely , Correspondence can never be exact ).
Essentially , Each measurement point provides only constraints along its surface normals . In order to model this structure , We consider that each sampling point is distributed with high covariance along its local plane , And in the direction of the surface normal ( Perpendicular to the plane ) With very low covariance distribution ( That is, the point cloud is distributed on the local plane ). Suppose we locally fit the normal vector of a point on the plane e1 Is the edge X The shaft , link 1, Then the covariance matrix at this point becomes :
( ϵ 0 0 0 1 0 0 0 1 ) (9) \left(\begin{array}{lll} \epsilon & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right)\tag{9} ⎝⎛ϵ00010001⎠⎞(9)
ϵ \epsilon ϵ Is a very small constant along the normal direction .
Because in fact, the normal vector is not necessarily along x Axis direction , Therefore, coordinate conversion is required . hypothesis b i , a i b_i,a_i bi,ai The corresponding normal vectors are u i , v i u_i,v_i ui,vi, Then their corresponding covariance matrix is :
C i B = R μ i ⋅ ( ϵ 0 0 0 1 0 0 0 1 ) ⋅ R μ i T C i A = R ν i ⋅ ( ϵ 0 0 0 1 0 0 0 1 ) ⋅ R ν i T \begin{array}{l} C_{i}^{B}=\mathbf{R}_{\mu_{i}} \cdot\left(\begin{array}{ccc} \epsilon & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right) \cdot \mathbf{R}_{\mu_{i}}^{T} \\ C_{i}^{A}=\mathbf{R}_{\nu_{i}} \cdot\left(\begin{array}{ccc} \epsilon & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right) \cdot \mathbf{R}_{\nu_{i}}^{T} \end{array} CiB=Rμi⋅⎝⎛ϵ00010001⎠⎞⋅RμiTCiA=Rνi⋅⎝⎛ϵ00010001⎠⎞⋅RνiT
R ν i \mathbf{R}_{\nu_{i}} Rνi by e1 To vi Rotation matrix .
The above covariance calculation process can be expressed as shown in the figure below , link 2:
After determining the covariance matrix, use the formula (4) That is to say plane to plane ICP Or call it GICP.
This is actually how to determine the covariance matrix .
Obviously it can be done through pca Calculate the covariance matrix ( Instead of the above solution process ):
C = 1 N ⋅ ∑ i = 1 N ⋅ ( p i − p ˉ ) ⋅ ( p i − p ˉ ) T C=\frac{1}{N} \cdot \sum_{i=1}^{N} \cdot\left(p_{i}-\bar{p}\right) \cdot\left(p_{i}-\bar{p}\right)^{T} C=N1⋅i=1∑N⋅(pi−pˉ)⋅(pi−pˉ)T
pca Pay attention to the formula when solving (4) There is an inverse process for covariance , Note that when the covariance matrix is singular , Replace with a small amount 0 value ( similar NDT Medium handling ).
PCL in GICP Code application
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/registration/gicp.h>
int gicp(const pcl::PointCloud<pcl::PointXYZ>::Ptr src_cloud,
const pcl::PointCloud<pcl::PointXYZ>::Ptr tgt_cloud,
pcl::PointCloud<pcl::PointXYZ>::Ptr transformed_source)
{
pcl::GeneralizedIterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> gicp;
gicp.setInputSource(src_cloud);
gicp.setInputTarget(tgt_cloud);
//gicp.setMaximumIterations(max_iter);
gicp.align(*transformed_source);
return 1;
}
边栏推荐
- Pytorch笔记
- Cookies and sessions
- Chapter VI data type (V)
- TinyMCE series (III) introduction to common TinyMCE APIs
- Must do skill -- use ffmpeg command to quickly and accurately cut video
- 恭喜Splashtop 荣获2022年 IT Europa “年度垂直应用解决方案”奖
- ELK搭建指南
- [foundation of deep learning] back propagation method (1)
- 5G NR协议学习--TS38.211下行通道
- 树的前序,中序,后序遍历
猜你喜欢
随机推荐
开源项目-(ERP+酒店+电商)后台管理系统
Miscellaneous instructions of arm instruction set
Analyze the implementation principle of the onion model, and connect the onion model in your own project
Longest string without duplicate characters (leetcode 3)
PDSCH related
promise的理解已经利用promise实现图片的预加载(顺序加载)
object. Defineproperty basic usage
Visio 2019 uses PJ
The second day of QML study
Reprint --win10 open the task manager to solve the blue screen problem
Find the median of two ordered arrays (leetcode 4)
Click to generate 4-bit random number and verify code setting
[译] QUIC Wire Layout Specification - Packet Types and Formats | QUIC协议标准中文翻译(2) 包类型和格式
Kotlin扩展函数实现原理
LeetCode_二分搜索_中等_162. 寻找峰值
Multiplication instruction of arm instruction set
Chapter VI data type (V)
PDSCH 相关
B. Wall painting (C language)
必杀技--使用FFmpeg命令快速精准剪切视频









