|
发布时间: 2017-08-16 |
图像分析和识别 |
|
|
收稿日期: 2016-12-09; 修回日期: 2017-04-21
基金项目: 四川省教育厅科研基金项目(14ZB0111);教育部共建重点实验室“制造过程测试技术实验室”开放基金项目(14tdzk06)
第一作者简介: 陈龙(1990—), 男, 西南科技大学机械工程专业硕士研究生, 主要研究方向为反求工程与快速制造。E-mail:lonny_snail@foxmail.com
中图法分类号: TP391.41
文献标识码: A
文章编号: 1006-8961(2017)08-1089-09
|
摘要
目的 点云精简是曲面重建等点云处理的一个重要前提,针对以往散乱点云精简算法的精简结果存在失真较大、空洞及不适用于片状点云的问题,提出一种自适应K-means聚类的点云精简算法。方法 首先,根据k邻域计算每个数据点的曲率、点法向与邻域点法向夹角的平均值、点到邻域重心的距离、点到邻域点的平均距离,据此运用多判别参数混合的特征提取方法识别并保留特征点,包括曲面尖锐点和边界点;然后,对点云数据建立自适应八叉树,为K-means聚类提供与点云密度分布相关的初始化聚类中心以及K值;最后,遍历整个聚类,如果聚类结果中含有特征点则剔除其中的特征点并更新聚类中心,计算更新后聚类中数据点的最大曲率差,将最大曲率差大于设定阈值的聚类进行细分,保留最终聚类中距聚类中心最近的数据点。结果 在聚类方面,将传统的K-means聚类和自适应K-means聚类算法应用于bunny点云,后者在聚类的迭代次数、评价函数值和时间上均优于前者;在精简方面,将提出的精简算法应用于封闭及片状两种不同类型的点云,在精简比例为1/5时fandisk及saddle模型的精简误差分别为0.29×10-3、-0.41×10-3和0.037、-0.094,对于片状的saddle点云模型,其边界收缩误差为0.030 805,均小于栅格法和曲率法。结论 本文提出的散乱点云精简算法可应用于封闭及片状点云,精简后的数据点分布均匀无空洞,对片状点云进行精简时能够保护模型的边界数据点。
关键词
点云精简; 八叉树; K-means聚类; 片状点云; 边界点
Abstract
Objective With the rapid development of 3D scanning technology in the field of reverse engineering, point clouds that are obtained by 3D scanning devices are commonly dense and disordered.These characteristics of point clouds result in a large number of redundancy data.Moreover, subsequent point processing work, such as smoothing, meshing, and surface reconstruction becomes difficult and inefficient.Therefore, point cloud simplification is a considerably significant prerequisite for smoothing, meshing, surface reconstruction, and other follow-up point cloud processing works.In recent years, point cloud simplification algorithms based on feature preserving method can obtain a better simplified effect than algorithms based on nonselective reduction method presented, which have been widely utilized in several studies.However, the existing algorithms for point cloud simplification still have some inevitable shortcomings, including a large lack of fidelity to the origin, hole generation, and inadaptability to flaky point clouds.This study presents a simplification algorithm of scattered point cloud based on an adaptive K-means clustering, aiming to solve the problems in the existing aforementioned simplified algorithms. Method The curvature, average vector angle between points, the K-nearest neighborhood points, the distance from the point to its K-nearest neighborhood gravity center, and the average distance from the point to its K-nearest neighborhood points for each data point are calculated.The feature discriminant parameter and feature discriminant threshold are defined based on the four parameters regarded as the most important by the proposed algorithm.A point is recognized as a feature point when its value of discriminant parameter is greater than the threshold value.Thus, the feature extraction based on multiple parameters hybridization method is adopted to identify and preserve these feature points, including surface sharp and boundary points.Then, an adaptive octree is established for the point cloud to allow the K-means to initialize cluster centers and k value, which are related to the density distribution of the point cloud.Finally, if the clustering results contain the feature points, then the feature points in the clustering are removed and the cluster centers are updated.In general, cluster members in flat areas are sufficiently similar to each other in the spatial and feature domain.Thus, the cluster center can be employed to represent the cluster.However, in high curvature areas, the cluster members may not be similar to each other in the spatial and feature field because of highly detailed features.Therefore, the cluster will be subdivided to preserve the detail features when the maximum curvature difference between data points in the cluster is greater than the threshold value.The clustering subdivision will continue until the maximum curvature difference is smaller than the threshold value or when only one data point in the cluster is observed.The nearest point to the cluster center is preserved to represent the cluster after the clustering subdivision. Result In view of clustering, the bunny point cloud is considered as an example for the comparison of traditional K-means clustering algorithm and adaptive K-means clustering algorithm.The comparison result shows that the adaptive K-means clustering algorithm can obtain better data in terms of number of iterations, evaluation function value, and runtime compared with K-means clustering algorithm.In the aspect of simplification, the proposed reduction algorithm is applied to two types of point clouds (i.e., closed-boundary and flaky point clouds).The experimental results show that when the simplification ratio has the value of 1/5, the reduction errors of the fandisk and saddle models are 0.29×10-3, -0.41×10-3, and 0.037, -0.094.Moreover, the boundary shrinkage error of the saddle model is 0.030 805.The aforementioned error values are less than the error values of the grid simplification method and the curvature simplification method. Conclusion The proposed scattered point cloud simplification algorithm can be used for closed-boundary and flaky point clouds.Moreover, the simplified point cloud is well-distributed in space and can avoid holes.The boundary points of the model can also be protected when the algorithm is applied on the flaky point cloud model.
Key words
point cloud simplification; octree; K-means clustering; flake point cloud; boundary points
0 引言
随着3维激光扫描技术的快速发展,在逆向工程领域通过3维扫描仪获取的模型点云数据精度越来越高,但随之而来的是点云数据量极其庞大,在进行曲面重建、光顺等点云数据处理时大量消耗计算机资源和时间,因此,点云精简是点云数据处理中一个重要的研究课题。
在散乱点云数据精简方面,国内外学者做了大量研究。Sun等人[1]提出了包围盒法进行点云精简,其原理是首先对散乱点云建立最小包围盒,然后将包围盒等分为多个小栅格,最后针对每个小栅格寻找距离栅格中心最近的点代替立方体中的所有点。包围盒法虽然可以达到均匀的效果但精简后特征丢失严重。Martin等人[2]提出了均匀网格法,该方法同样在最小包围盒的基础上建立均匀栅格,然后在每个栅格中计算数据点在
基于以上分析,提出一种自适应K-means聚类点云精简算法,利用自适应八叉树提供与模型密度相关的初始化聚类中心以加快聚类收敛速度,在较平坦区域中聚类精简可达到点云分布均匀无空洞的效果。采用多判别参数法以识别模型的曲面尖锐点及边界特征点,并将曲率差大于阈值的聚类进行迭代细分以保留模型细节特征,可降低点云精简时的误差。
1 算法简介
该算法首先运用多判别参数混合的点云特征提取方法[7]检测并保留散乱点云中的特征点,包括曲面突变点及非封闭点云的边界点,以最大限度降低精简后的失真现象;然后针对点云建立自适应八叉树为K-means聚类提供初始化聚类中心;最后将聚类结果中的特征点剔除并更新聚类信息,将聚类细分以保留细节特征。
1.1 自适应八叉树
八叉树是一种用于表示3维空间的树结构,每个内部节点拥有8个子节点,分割结束条件一般为递归深度,而自适应八叉树的的分割结束条件则为节点中数据点的个数。自适应八叉树应用于散乱点云时其分割的结束条件可以是节点中所包含数据点的个数、点法向夹角或曲率的标准差等,因此当分割结束条件为节点中点云数据点的个数时其叶子节点的分布较为均匀,而用于非均匀点云模型时在密度较高的区域分布密集,而在点云密度较低的区域分布稀疏,因此当自适应八叉树应用于点云空间分割时其叶子节点的分布具有点云密度相关性[8]。
1.2 K-means聚类
K-means聚类是数据挖掘中的经典算法之一,属于重要的无监督学习方法,广泛应用于机器智能、模式识别和图形图像等领域[9]。该算法以欧式距离为相关性的度量,将数据点划分为
1.3 算法流程
定义输入的散乱点云数据集为
1) 点云数据中特征点的检测。计算数据点曲率
2) 自适应K-means聚类初始化。针对散乱点云数据建立自适应八叉树,其分割结束条件设定为节点中包含的数据点个数
3) 聚类细分。遍历聚类将其中的特征点剔除,更新剔除特征点后的聚类中心、数据点和评价函数,为了保留点云模型的细节特征,计算每个聚类中数据点之间的最大曲率差,将最大曲率差大于设定阈值的聚类进行迭代细分,聚类细分后再次更新聚类信息,最后保留距离聚类中心最近的数据点。
2 自适应K-means聚类精简
本文提出的自适应K-means聚类精简方法可以处理点云分布均匀及非均匀的数据点集,且适用于封闭及片状的点云模型。在使用特征检测方法识别并保护点云特征点的前提下进行精简,进行点云精简时将含有细小特征的聚类继续迭代细分以保留点云的细节特征。本文精简方法分为特征点检测、聚类初始化和聚类细分3步进行。
2.1 特征点检测
为了尽量减弱点云精简带来的模型特征和边缘边界等区域的收缩、失真现象,本文在点云精简之前首先进行模型特征点和边界点的检测并保护,防止在后续的点云精简操作中误删特征点,点云模型的特征提取将在后续的点云精简中极大地降低精简误差。
采用文献[7]中多参数混合的散乱点云特征检测方法对模型的特征点进行识别和保护,当数据点经检测为特征点时令其bool运算标志位feature point = true,在点云精简中此标志位为true的点予以保留。具体检测方法如下:
针对每个数据点及其
$ {t_i} = \frac{{\alpha {C_i} + \beta {\theta _i} + \gamma {D_{1i}}}}{{{D_{2i}}}} $ | (1) |
式中,α、β和γ分别为曲率、法矢夹角和点到邻域重心距离控制系数,定义判别阈值为
$ {T_i} = \frac{{\eta \sum\limits_{i = 1}^N {{w_i}} }}{N} $ | (2) |
式中,
如图 1所示为将特征提取算法应用于不同模型的提取效果,其中wilhelm为点云分布相对均匀的模型,由提取效果可见模型面部特征提取准确,边缘清晰;而nokia为非均匀的模型,具有强弱特征、连续变化曲线以及内外边缘,特征提取难度较大,由提取结果可见模型特征提取清晰准确。
2.2 聚类初始化
K-means聚类结果的好坏依赖于初始化聚类中心以及
由于散乱点云数据量庞大且模型复杂,将K-means聚类用于点云精简时就需要精简快速结果准确,因此本文运用自适应八叉树为K-means聚类提供初始化聚类中心,保证初始化聚类中心的分布相对均匀,用于非均匀的点云数据时初始化聚类中心能够与密度的变化相关,以减少聚类的迭代次数同时有利于聚集相近特征的数据点,达到精简快速结果准确的目的。
如图 2所示为将自适应八叉树应用于数据点为34 834的bunny点云模型给K-means聚类提供不同的
为了验证本文初始化聚类中心选择方法的有效性,如表 1所示在容差
表 1
bunny模型不同初始化聚类中心选择法比较
Table 1
Comparison of different initialization clustering center selection method for bunny model
方法 | 迭代次数 | 平均评价 函数 |
平均 时间/s |
|||
最高 | 最低 | 平均 | ||||
传统 K-means |
674 | 39 | 27 | 33 | 4 898.748 | 4.402 |
1 005 | 27 | 21 | 24 | 3 298.40 | 4.02 | |
2 043 | 17 | 15 | 16 | 1 710.43 | 2.589 | |
本文 | 674 | 24 | 24 | 24 | 4 769.93 | 3.891 |
1 005 | 18 | 18 | 18 | 3 213.87 | 2.687 | |
2 043 | 11 | 11 | 11 | 1 610.10 | 1.657 |
2.3 聚类结果分类
一般情况下,点云精简后的失真现象多发生在特征区域。由于本文已将点云模型中的强特征点进行检测并保护,因此可以极大的降低点云精简误差。当聚类处于模型中的平坦区域时可以将距离中心最近的数据点代替整个聚类,但是在曲面变化不大的区域仍然有较多弱特征存在,若采用同样的精简策略将会丢失过多细小特征。文献[13]中通过计算每个聚类中数据点之间的最大法向量偏差值与用户设定的阈值进行对比,大于阈值的聚类则继续分割为两个子聚类,再将新生成的聚类判断是否细分,直至满足最大法向量偏差值小于阈值或聚类中只剩下一个数据点为止。借鉴文献[13]中的方法,考虑到在特征区域聚类的细分将耗费大量时间且本文已将强特征点识别并保护,而且法向量计算较为复杂,因此本文的聚类细分主要考虑保留细小特征点,具体方法为:遍历所有聚类,将包含特征点的聚类选出并剔除特征点后更新中心,然后针对每个聚类采用PCA方法计算其包含数据点之间的最大曲率差,与设定的阈值
如图 3所示在检测相同数量的强特征点以及聚类参数不变的前提下,对bunny模型进行自适应K-means聚类精简中采用细分后的精简结果与未细分的对比情况。由图 3可以看出,采用聚类细分后的精简结果比未细分的多保留了860个细节特征点,大都分布与强特征区域附近,由此可见,采用最大曲率差进行聚类细分的方法是可行的,而细节特征点的数量可通过改变阈值
3 实例应用及分析
所提出的自适应K-means聚类的点云精简算法采用C++语言编写,使用OpenGL库函数进行显示,运行平台配置为Intel Core i3-2330M 2.2 GHz,内存4.0 GB。
3.1 参数选择
本文提出的散乱点云精简算法需设定7个参数,分别为
3.2 不同精简比例下的精简结果
为了验证本文算法的可行性,将其应用于两种不同的模型进行精简,一种为封闭的dragon模型,该模型实际尺寸较小,特征复杂且数据量庞大;另一种为片状点云模型wilhelm,该模型尺寸较大,具有大量的边界信息。设定精简比例为1/5、1/10及1/15,并使用Geomagic 12.0计算平均误差,精简效果如图 4和图 5所示。dragon模型的点云数据点数量为437 645,当精简比例为1/5时正负方向上的平均误差
3.3 不同精简算法精简结果对比
为了验证本文算法的有效性,将本文方法应用于点云模型进行精简,并于曲率精简法和栅格精简法进行对比。在模型的选取中为了体现算法的适应性,因此选择两种不同的模型:一种为封闭的点云模型fandisk,点云数据点数量为55 355,该模型包含直线、连续变化的曲线特征,且点云分布不均匀;另一种为片状的点云模型saddle,点云数据点数量为12 341,该模型曲面过渡平缓,具有大量的边界信息,点云精简中如果边界数据未能加以保护将发生较为严重的边界收缩现象。
3.3.1 精简效果、误差及时间对比
图 6和图 7分别为fandisk和saddle模型采用1/5精简比例时采用栅格法、曲率法及本文算法的精简效果和误差对比,可以看出,栅格法精简效果整体较为均匀,但特征信息丢失严重导致精简误差较大,平均误差
在精简比例同为1/5的前提下,针对fandisk和saddle两个不同模型,将采用栅格法、曲率法及本文方法进行精简时的运行时间进行对比,如表 2所示为3种算法运行时间的对比情况,可知本文方法在运行时间上大于其他2种方法,主要原因在于采用聚类精简时需进行迭代更新聚类信息等待评价函数收敛,因此本文方法耗时较长。
表 2
3种精简算法运行时间对比
Table 2
Comparison of time consumption for three kinds of simplified methods
/s | |||||
模型 | 栅格 法 |
曲率 法 |
本文方法 | ||
特征检测 | 聚类精简 | 总时间 | |||
fandisk | 0.048 | 1.112 | 0.995 | 2.189 | 3.184 |
saddle | 0.014 | 0.276 | 0.409 | 1.363 | 1.772 |
3.3.2 边界收缩误差对比
由于曲率法及栅格法检测片状点云边界数据点的能力较弱,导致精简过程中边界信息大量丢失,精简后的模型边界收缩严重,而本文精简算法保留了片状点云的边界数据点,因此精简结果中边界收缩较小。由于图 6和图 7中的平均误差为geomagic软件计算得来,该误差仅反映精简后点云数据构成的区域与原始点云对应区域之间的偏差情况,因此该误差无法评估片状点云精简后因边界信息丢失而发生的边界收缩误差,为了准确地表达片状点云精简产生的边界收缩情况,引用点云配准中ICP(iterative closest point)算法的残余误差
$ {E_{{\rm{data}}}} = \frac{1}{{N'}}\sum\limits_{i = 1}^{N'} {{{\left\| {{p_i}-{q_i}} \right\|}^2}} $ | (3) |
式中,
计算两条边界之间的残余误差具体方法为:将图 7中4片点云的边界进行提取,然后分别将不同方法精简后点云的边界与原始点云边界合并,最后离散采样两条曲线的数据点计算其残余误差,为了更加清晰地看到边界的收缩变化情况,本文已将模型旋转了一定角度以获得较为明显的边界曲线对比图像。如图 8所示为saddle原始点云边界与3种精简方法精简后点云边界之间的残余误差情况。
根据图 8中3种方法精简后点云边界的收缩情况对比可知:使用曲率法进行点云精简后其边界收缩导致的残余误差最大,为
4 结论
提出了一种自适应K-means聚类的散乱点云精简方法,以多判别参数混合方法检测模型特征点,采用自适应八叉树为K-means聚类提供初始化聚类中心和
本文方法应用于封闭或片状的点云模型时均可得到较好的精简效果,但对于具有薄壁特征的点云模型时会出现特征点误判和聚类不准确的情况,原因在于建立点云拓扑关系及聚类时附近数据点寻找错误;另外由于本文采用聚类的方式进行点云精简操作,在面对百万数量的点云时,存在着时间效率较低的问题。因此下一步研究工作将会考虑改变建立点云拓扑关系的方式以适应具有薄壁特征的点云模型;同时在面对百万数量级别的点云时,可在聚类的迭代更新操作中将类中心点变化较小的簇采用类中心不变的策略以减少计算量,提高精简效率。
参考文献
-
[1] Sun W, Bradley C, Zhang Y F, et al. Cloud data modelling employing a unified, non-redundant triangular mesh[J]. Computer-Aided Design, 2001, 33(2): 183–193. [DOI:10.1016/S0010-4485(00)00088-9]
-
[2] Martin R R, Stroud I A, Marshal A D.Data reduction for reverse engineering[R].Reccad:Deliverable Document Coperunicus Project, Computer and Automation Institute of Hungarian Academy of Science, 1996.
-
[3] Lee K H, Woo H, Suk T. Point data reduction using 3D grids[J]. The International Journal of Advanced Manufacturing Technology, 2001, 18(3): 201–210. [DOI:10.1007/s001700170075]
-
[4] Kim S J, Kim C H, Levin D. Surface simplification using a discrete curvature norm[J]. Computers & Graphics, 2002, 26(5): 657–663.
-
[5] Han H Y, Han X, Sun F S, et al. Point cloud simplification with preserved edge based on normal vector[J]. Optik-International Journal for Light and Electron Optics, 2015, 126(19): 2157–2162. [DOI:10.1016/j.ijleo.2015.05.092]
-
[6] Shi B Q, Liang J, Zhang X Q, et al. Research on point cloud simplification with preserved features[J]. Journal of Xi'an Jiaotong University, 2010, 44(11): 37–40. [史宝全, 梁晋, 张晓强, 等. 特征保持的点云精简技术研究[J]. 西安交通大学学报, 2010, 44(11): 37–40. ] [DOI:10.7652/xjtuxb201011008]
-
[7] Chen L, Cai Y, Zhang J S, et al.Feature point extraction of scattered point cloud based on multiple parameters hybridization method[J/OL].Application Research of Computers, 2017, 34(9).http://www.cnki.net/kcms/detail/51.1196.TP.20160918.1851.036.html. [陈龙, 蔡勇, 张建生, 等. 基于多判别参数混合方法的散乱点云特征提取[J/OL]. 计算机应用研究, 2017, 34(9). http://www.cnki.net/kcms/detail/51.1196.TP.20160918.1851.036.html.]
-
[8] Zheng D J, Lu K Q. Quick picking method for 3D piont cloud based on adaptive octree[J]. Journal of Mechanical & Electrical Engineering, 2016, 33(4): 417–420, 425. [郑德炯, 卢科青. 基于自适应八叉树的三维点云快速拾取方法研究[J]. 机电工程, 2016, 33(4): 417–420, 425. ]
-
[9] Wu S H, Cheng Y, Zheng Y N, et al. Survey on K-means algorithm[J]. New Technology of Library and Information Service, 2011, 27(5): 28–35. [吴夙慧, 成颖, 郑彦宁, 等. K-means算法研究综述[J]. 现代图书情报技术, 2011, 27(5): 28–35. ] [DOI:10.11925/infotech.1003-3513.2011.05.05]
-
[10] Yao Y H, Shi X L. K-means rough clustering algorithm based on optimized initial center[J]. Computer Engineering and Applications, 2010, 46(34): 126–128. [姚跃华, 史秀岭. 一种优化初始中心的K-means粗糙聚类算法[J]. 计算机工程与应用, 2010, 46(34): 126–128. ] [DOI:10.3778/j.issn.1002-8331.2010.34.038]
-
[11] Hansen P, Ngai E, Cheung B K, et al. Analysis of global K-means, an incremental heuristic for minimum sum-of-squares clustering[J]. Journal of Classification, 2005, 22(2): 287–310. [DOI:10.1007/s00357-005-0018-3]
-
[12] Jain A K. Data clustering:50 years beyond K-means[J]. Pattern Recognition Letters, 2010, 31(8): 651–666. [DOI:10.1016/j.patrec.2009.09.011]
-
[13] Shi B Q, Liang J, Liu Q. Adaptive simplification of point cloud using K-means clustering[J]. Computer-Aided Design, 2011, 43(8): 910–922. [DOI:10.1016/j.cad.2011.04.001]
-
[14] Tam G K L, Cheng Z Q, Lai Y K, et al. Registration of 3D point clouds and meshes:a survey from rigid to nonrigid[J]. IEEE Transactions on Visualization and Computer Graphics, 2013, 19(7): 1199–1217. [DOI:10.1109/TVCG.2012.310]
-
[15] Xin W, Pu J X. Point cloud integration base on distances between points and their neighborhood centroids[J]. Journal of Image and Graphics, 2011, 16(5): 886–891. [辛伟, 普杰信. 点到邻域重心距离特征的点云拼接[J]. 中国图象图形学报, 2011, 16(5): 886–891. ] [DOI:10.11834/jig.20110515]