当前位置:网站首页>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;
}
边栏推荐
- Rich text editor copying pictures in word documents
- 【Leetcode】199. Right view of binary tree
- Performance comparison test of channel and condition variables of golang in single production and single consumption scenarios
- LeetCode_二分搜索_中等_162. 寻找峰值
- TinyMCE series (III) introduction to common TinyMCE APIs
- 爱可可AI前沿推介(6.12)
- object.defineProperty 基本使用
- Elk construction guide
- 机器学习之线性模型
- 鸡尾酒排序
猜你喜欢

安装canvas遇到的问题和运行项目遇到的报错

TinyMCE series (II) TinyMCE plug-in development

Elk construction guide

The second day of QML study

Find the median of two ordered arrays (leetcode 4)
![[foundation of deep learning] back propagation method (1)](/img/0b/540c1f94712a381cae4d30ed624778.png)
[foundation of deep learning] back propagation method (1)

PDSCH 相关

LeetCode 497. 非重叠矩形中的随机点(前缀和+二分)

TinyMCE series (I) TinyMCE environment construction

ARM processor mode and register
随机推荐
传统的DOM渲染方式?
promise的理解已经利用promise实现图片的预加载(顺序加载)
Backtracking, eight queens
获取本机所有ipv4, ipv6地址
Getting started with NVIDIA Jetson nano Developer Kit
LeetCode_ Binary search_ Medium_ 162. looking for peaks
ARM processor mode and register
Click to generate 4-bit random number and verify code setting
回溯法, 八皇后
Miscellaneous instructions of arm instruction set
DOM+JS+轮播图+无时间
Analyze the implementation principle of the onion model, and connect the onion model in your own project
AutoLock 解决加锁后忘记解锁问题
ARP protocol data processing process of neighbor subsystem
The second regular match is inconsistent with the first one, and the match in the regular loop is invalid
【Leetcode】199. Right view of binary tree
The direction of this
Rust语言学习
导航中,添加边框影响布局的解决方法
Traditional DOM rendering?