我正在使用基于点云库(PCL)的C ++实现的kd-tree最近邻搜索。数据集包含约220万个点。我正在为每个其他点搜索NN点。搜索半径设置为2.0。完全计算需要大约12小时!我使用的是装有4GB RAM的Windows 64位机器。这种情况在kd-tree搜索中很常见吗?我想知道是否有任何其他C ++库可用于3D点云数据,速度更快。我听说过ANN C ++库和CGAL,但不确定它们有多快。
我正在使用基于点云库(PCL)的C ++实现的kd-tree最近邻搜索。数据集包含约220万个点。我正在为每个其他点搜索NN点。搜索半径设置为2.0。完全计算需要大约12小时!我使用的是装有4GB RAM的Windows 64位机器。这种情况在kd-tree搜索中很常见吗?我想知道是否有任何其他C ++库可用于3D点云数据,速度更快。我听说过ANN C ++库和CGAL,但不确定它们有多快。
....
好的,我承认,我现在也很好奇,我将运行一些测试!
....
ANN
(我不会发布代码,这样答案就不会太大。文档中有示例,当然你也可以问!). 输出:
// 对于克莱因瓶
samaras@samaras-A15:~/Inria/nn_libs/ANN/ann_1.1.2/code$ g++ main.cpp -O3 -I ../include/ -L../lib -lANN -std=c++0x -o myExe
samaras@samaras-A15:~/Inria/nn_libs/ANN/ann_1.1.2/code$ ./myExe
N = 1000000
D = 3
ε = 0 // full accuracy
Misses: 0
creation of the tree took 1.06638 seconds.
Brute force for min: 0.009985598 seconds.
NN for 0.0 0.000078551 seconds.
Speedup of ANN for NN = 8.721533780
对于 ε = 0.1
,我得到了:
Misses: 1000
creation of the tree took 0.727613 seconds.
Brute force for min: 0.006351318 seconds.
NN for 0.0 0.000004260 seconds.
Speedup of ANN for NN = 8.678169573
// 用于球体
ε = 0
Misses: 0
creation of the tree took 1.28098 seconds.
Brute force for min: 0.006382912 seconds.
NN for 0.0 0.000022341 seconds.
Speedup of ANN for NN = 4.897436311
ε = 0.1
Misses: 1000
creation of the tree took 1.25572 seconds.
Brute force for min: 0.006482465 seconds.
NN for 0.0 0.000004379 seconds.
Speedup of ANN for NN = 5.144413371
samaras@samaras-A15:~/code/NN$ ./myExe
ε = 0
SplitingRule = Sliding_midpoint, N = 1000000, D = 3
creation of the tree took 0.02478 seconds.
Tree statistics:
Number of items stored: 1000000
Number of nodes: 471492
Tree depth: 34
0x80591e4
Brute force for min: 0.007979495 seconds.
NN for 0.0 0.008085704 seconds.
Speedup of cgal for NN = 0.983849423
ε = 0.1
SplitingRule = Sliding_midpoint, N = 1000000, D = 3
creation of the tree took 0.02628 seconds.
Tree statistics:
Number of items stored: 1000000
Number of nodes: 471492
Tree depth: 34
0x80591e4
Brute force for min: 0.007852951 seconds.
NN for 0.0 0.007856228 seconds.
Speedup of cgal for NN = 0.996250305
// 球体
samaras@samaras-A15:~/code/NN$ ./myExe
ε = 0
SplitingRule = Sliding_midpoint, N = 1000000, D = 3
creation of the tree took 0.025502 seconds.
Tree statistics:
Number of items stored: 1000000
Number of nodes: 465002
Tree depth: 32
0x80591e4
Brute force for min: 0.007946504 seconds.
NN for 0.0 0.007981456 seconds.
Speedup of cgal for NN = 0.992449817
samaras@samaras-A15:~/code/NN$ ./myExe
ε = 0.1
SplitingRule = Sliding_midpoint, N = 1000000, D = 3
creation of the tree took 0.025106 seconds.
Tree statistics:
Number of items stored: 1000000
Number of nodes: 465002
Tree depth: 32
0x80591e4
Brute force for min: 0.008115519 seconds.
NN for 0.0 0.008117261 seconds.
Speedup of cgal for NN = 0.996702679
在我的测试中,ANN比CGAL更清晰更快,可能对您也是如此!
一则旁注:
实际上,您要求每个点的NN。然而,该库不知道这一点,并且不考虑已为每个点完成的先前工作,这是遗憾的。但是,我不知道是否有任何库可以做到这一点。