视觉SLAM十四讲——ch12实践(建图)

news2024/11/28 21:56:21

视觉SLAM十四讲——ch12的实践操作及避坑

  • 0.实践前小知识介绍
  • 1. 实践操作前的准备工作
  • 2. 实践过程
    • 2.1 单目稠密重建
    • 2.2 RGB-D稠密建图
    • 2.3 点云地图
    • 2.4 从点云重建网格
    • 2.5 八叉树地图
  • 3. 遇到的问题及解决办法
    • 3.1 cmake ..时,出现opencv版本问题
    • 3.2 make -j8时,出现一些错误,有关PCL和opencv版本的问题。
    • 3.3 cmake ..时,会出现vtk的问题,
    • 3.4 运行 ./dense_mapping /home/fighter/slam/slambook2/ch12/test_data时,出现段错误

0.实践前小知识介绍

“make -j” 是一个 Linux 命令,它使用所有可用的 CPU 核心来并行编译程序。通常在不指定进程数量时,使用这个命令可以最大化地利用 CPU 资源以加快编译速度。
这个命令会启动尽可能多的进程来同时编译程序,以便快速生成可执行文件。此命令将自动检测计算机上可用的 CPU 核心数量,并在所有可用的核心上启动相应数目的编译任务。
需要注意的是,由于多个进程同时在运行,因此使用 “make -j” 命令时可能会出现输出混乱的情况,但这不影响编译结果的正确性。如果您希望更清晰地查看编译过程,可以使用 “make VERBOSE=1” 命令,它会打印出更详细的编译信息。

“make -j8” 是一个 Linux 命令,意思是在编译时使用8个并行进程来加快编译速度。其中的 “-j” 参数表示并行进程数,后面的数字 “8” 表示使用 8 个进程来编译。

通过使用多个并行进程,可以同时处理多个编译任务,并且不会影响编译的正确性。这样可以大大提高编译的速度,在硬件条件允许的情况下,建议使用该参数来加快编译速度。

需要注意的是,并不是所有的编译任务都适合使用多进程并行编译,因此在使用该参数时,需要根据实际情况进行选择。同时也需要注意,如果硬件条件较差,使用过多的并行进程可能会导致编译失败或者系统卡死,因此需要根据自己的硬件条件来进行调整。

1. 实践操作前的准备工作

  1. 安装PCL
sudo apt-get install libpcl-dev pcl-tools
  1. 安装octomap
sudo apt-get install liboctomap-dev octovis
  1. 在终端中进入ch12文件夹下,顺序执行以下命令进行编译。
mkdir build
cd build
cmake ..
//注意,j8还是其他主要看自己的电脑情况
make -j8
  1. 在build文件中进行运行。
    注意: 在make过程中,会出现warning,但是对我们此实践的过程几乎没有影响。

  2. 下载使用的测试数据,数据是提供了一架无人机采集的单目俯视图,一共200张,同时提供了每张图像的真是位姿。下载地址为http://rpg.ifi.uzh.ch/datasets/remode_test_data.zip

2. 实践过程

2.1 单目稠密重建

在build中执行语句:

 cd dense_mono
 ./dense_mapping /home/fighter/slam/slambook2/ch12/test_data

运行结果:
第35次迭代图像:
第35次迭代

//刚开始运行时的平均方差和平均误差:
*** loop 1 ***
Average squared error = 1.84285, average error: -1.12517
//迭代到199次时的平均方差和平均误差:
*** loop 199 ***
Average squared error = 0.253473, average error: -0.00722449

全部结果:

read total 202 files.
*** loop 1 ***
Average squared error = 1.84285, average error: -1.12517
*** loop 2 ***
Average squared error = 1.42146, average error: -0.865388
*** loop 3 ***
Average squared error = 1.05544, average error: -0.62268
*** loop 4 ***
Average squared error = 0.879682, average error: -0.515219
*** loop 5 ***
Average squared error = 0.45456, average error: -0.177368
*** loop 6 ***
Average squared error = 0.396917, average error: -0.128648
*** loop 7 ***
Average squared error = 0.364525, average error: -0.10006
*** loop 8 ***
Average squared error = 0.350139, average error: -0.0846462
*** loop 9 ***
Average squared error = 0.340283, average error: -0.0772052
*** loop 10 ***
Average squared error = 0.331579, average error: -0.0711182
*** loop 11 ***
Average squared error = 0.325072, average error: -0.0668865
*** loop 12 ***
Average squared error = 0.319159, average error: -0.0616389
*** loop 13 ***
Average squared error = 0.314988, average error: -0.0576225
*** loop 14 ***
Average squared error = 0.310317, average error: -0.0543781
*** loop 15 ***
Average squared error = 0.307007, average error: -0.0517102
*** loop 16 ***
Average squared error = 0.303809, average error: -0.0494418
*** loop 17 ***
Average squared error = 0.301495, average error: -0.0477168
*** loop 18 ***
Average squared error = 0.29937, average error: -0.0460656
*** loop 19 ***
Average squared error = 0.298098, average error: -0.0450206
*** loop 20 ***
Average squared error = 0.297042, average error: -0.0441051
*** loop 21 ***
Average squared error = 0.296148, average error: -0.0433046
*** loop 22 ***
Average squared error = 0.295283, average error: -0.0425197
*** loop 23 ***
Average squared error = 0.294497, average error: -0.0418231
*** loop 24 ***
Average squared error = 0.293742, average error: -0.0412219
*** loop 25 ***
Average squared error = 0.293078, average error: -0.0406908
*** loop 26 ***
Average squared error = 0.292565, average error: -0.0402601
*** loop 27 ***
Average squared error = 0.292155, average error: -0.0398929
*** loop 28 ***
Average squared error = 0.291749, average error: -0.0395666
*** loop 29 ***
Average squared error = 0.291299, average error: -0.0392129
*** loop 30 ***
Average squared error = 0.290664, average error: -0.0387602
*** loop 31 ***
Average squared error = 0.290207, average error: -0.0384231
*** loop 32 ***
Average squared error = 0.289564, average error: -0.037996
*** loop 33 ***
Average squared error = 0.289188, average error: -0.0377422
*** loop 34 ***
Average squared error = 0.288831, average error: -0.0373816
*** loop 35 ***
Average squared error = 0.288169, average error: -0.0369677
*** loop 36 ***
Average squared error = 0.28776, average error: -0.0366579
*** loop 37 ***
Average squared error = 0.287351, average error: -0.0363873
*** loop 38 ***
Average squared error = 0.286934, average error: -0.0361053
*** loop 39 ***
Average squared error = 0.286412, average error: -0.0357436
*** loop 40 ***
Average squared error = 0.286034, average error: -0.0354667
*** loop 41 ***
Average squared error = 0.285515, average error: -0.0351335
*** loop 42 ***
Average squared error = 0.285065, average error: -0.0347901
*** loop 43 ***
Average squared error = 0.284475, average error: -0.0343606
*** loop 44 ***
Average squared error = 0.28398, average error: -0.0339507
*** loop 45 ***
Average squared error = 0.283484, average error: -0.0335147
*** loop 46 ***
Average squared error = 0.282962, average error: -0.0330494
*** loop 47 ***
Average squared error = 0.282207, average error: -0.0324265
*** loop 48 ***
Average squared error = 0.281722, average error: -0.0319793
*** loop 49 ***
Average squared error = 0.28126, average error: -0.0314694
*** loop 50 ***
Average squared error = 0.280613, average error: -0.0308945
*** loop 51 ***
Average squared error = 0.28026, average error: -0.0304981
*** loop 52 ***
Average squared error = 0.279828, average error: -0.0301664
*** loop 53 ***
Average squared error = 0.279481, average error: -0.0299141
*** loop 54 ***
Average squared error = 0.279225, average error: -0.0297781
*** loop 55 ***
Average squared error = 0.279093, average error: -0.0296969
*** loop 56 ***
Average squared error = 0.27885, average error: -0.029586
*** loop 57 ***
Average squared error = 0.278791, average error: -0.0295429
*** loop 58 ***
Average squared error = 0.278614, average error: -0.029461
*** loop 59 ***
Average squared error = 0.278394, average error: -0.0293721
*** loop 60 ***
Average squared error = 0.278216, average error: -0.0292924
*** loop 61 ***
Average squared error = 0.27807, average error: -0.0292331
*** loop 62 ***
Average squared error = 0.277898, average error: -0.0291653
*** loop 63 ***
Average squared error = 0.277636, average error: -0.0290668
*** loop 64 ***
Average squared error = 0.27748, average error: -0.0290064
*** loop 65 ***
Average squared error = 0.277295, average error: -0.0289306
*** loop 66 ***
Average squared error = 0.277196, average error: -0.0288857
*** loop 67 ***
Average squared error = 0.277002, average error: -0.0288019
*** loop 68 ***
Average squared error = 0.276856, average error: -0.0287178
*** loop 69 ***
Average squared error = 0.276715, average error: -0.028626
*** loop 70 ***
Average squared error = 0.276542, average error: -0.0285359
*** loop 71 ***
Average squared error = 0.27639, average error: -0.0284511
*** loop 72 ***
Average squared error = 0.276233, average error: -0.0283693
*** loop 73 ***
Average squared error = 0.276015, average error: -0.0282531
*** loop 74 ***
Average squared error = 0.275862, average error: -0.0281722
*** loop 75 ***
Average squared error = 0.275723, average error: -0.0280873
*** loop 76 ***
Average squared error = 0.275545, average error: -0.027981
*** loop 77 ***
Average squared error = 0.275377, average error: -0.0278906
*** loop 78 ***
Average squared error = 0.275231, average error: -0.0278025
*** loop 79 ***
Average squared error = 0.275086, average error: -0.0277176
*** loop 80 ***
Average squared error = 0.274987, average error: -0.0276476
*** loop 81 ***
Average squared error = 0.274899, average error: -0.0275886
*** loop 82 ***
Average squared error = 0.274696, average error: -0.0274517
*** loop 83 ***
Average squared error = 0.274517, average error: -0.0272981
*** loop 84 ***
Average squared error = 0.274293, average error: -0.0271339
*** loop 85 ***
Average squared error = 0.274005, average error: -0.0268708
*** loop 86 ***
Average squared error = 0.273686, average error: -0.0265032
*** loop 87 ***
Average squared error = 0.273051, average error: -0.0257165
*** loop 88 ***
Average squared error = 0.272044, average error: -0.0243797
*** loop 89 ***
Average squared error = 0.271037, average error: -0.0231086
*** loop 90 ***
Average squared error = 0.270173, average error: -0.0222034
*** loop 91 ***
Average squared error = 0.268837, average error: -0.0205596
*** loop 92 ***
Average squared error = 0.268364, average error: -0.0192558
*** loop 93 ***
Average squared error = 0.267513, average error: -0.0182724
*** loop 94 ***
Average squared error = 0.266708, average error: -0.0175116
*** loop 95 ***
Average squared error = 0.2659, average error: -0.0167705
*** loop 96 ***
Average squared error = 0.265119, average error: -0.0160555
*** loop 97 ***
Average squared error = 0.264688, average error: -0.0156661
*** loop 98 ***
Average squared error = 0.264175, average error: -0.0152503
*** loop 99 ***
Average squared error = 0.263741, average error: -0.0148952
*** loop 100 ***
Average squared error = 0.263298, average error: -0.0145078
*** loop 101 ***
Average squared error = 0.26283, average error: -0.0139689
*** loop 102 ***
Average squared error = 0.262504, average error: -0.0136983
*** loop 103 ***
Average squared error = 0.261961, average error: -0.0132759
*** loop 104 ***
Average squared error = 0.261467, average error: -0.0128025
*** loop 105 ***
Average squared error = 0.261184, average error: -0.0125387
*** loop 106 ***
Average squared error = 0.260951, average error: -0.0123502
*** loop 107 ***
*** loop 108 ***
Average squared error = 0.260779, average error: -0.0122728
*** loop 109 ***
Average squared error = 0.260547, average error: -0.0121443
*** loop 110 ***
Average squared error = 0.260369, average error: -0.0120564
*** loop 111 ***
Average squared error = 0.260171, average error: -0.0119496
*** loop 112 ***
Average squared error = 0.25991, average error: -0.0118314
*** loop 113 ***
Average squared error = 0.259633, average error: -0.0117062
*** loop 114 ***
Average squared error = 0.259358, average error: -0.0115578
*** loop 115 ***
Average squared error = 0.259097, average error: -0.0114197
*** loop 116 ***
Average squared error = 0.258921, average error: -0.0113019
*** loop 117 ***
Average squared error = 0.258636, average error: -0.0111453
*** loop 118 ***
Average squared error = 0.258323, average error: -0.0109411
*** loop 119 ***
Average squared error = 0.258012, average error: -0.010738
*** loop 120 ***
Average squared error = 0.25748, average error: -0.0103609
*** loop 121 ***
Average squared error = 0.256995, average error: -0.0100245
*** loop 122 ***
Average squared error = 0.256586, average error: -0.00968946
*** loop 123 ***
Average squared error = 0.256245, average error: -0.00937251
*** loop 124 ***
Average squared error = 0.255877, average error: -0.00895965
*** loop 125 ***
Average squared error = 0.255615, average error: -0.00863918
*** loop 126 ***
Average squared error = 0.255493, average error: -0.00842778
*** loop 127 ***
Average squared error = 0.255422, average error: -0.00832814
*** loop 128 ***
Average squared error = 0.255371, average error: -0.00828552
*** loop 129 ***
Average squared error = 0.255334, average error: -0.00825662
*** loop 130 ***
Average squared error = 0.255342, average error: -0.0082551
*** loop 131 ***
Average squared error = 0.25535, average error: -0.00825099
*** loop 132 ***
Average squared error = 0.25532, average error: -0.0082309
*** loop 133 ***
Average squared error = 0.255291, average error: -0.00821913
*** loop 134 ***
Average squared error = 0.255274, average error: -0.0082109
*** loop 135 ***
Average squared error = 0.255271, average error: -0.00820692
*** loop 136 ***
Average squared error = 0.255272, average error: -0.00819507
*** loop 137 ***
Average squared error = 0.255216, average error: -0.00817473
*** loop 138 ***
Average squared error = 0.255177, average error: -0.00815629
*** loop 139 ***
Average squared error = 0.255138, average error: -0.00814459
*** loop 140 ***
Average squared error = 0.255086, average error: -0.00812726
*** loop 141 ***
Average squared error = 0.25507, average error: -0.00812055
*** loop 142 ***
Average squared error = 0.254982, average error: -0.00808992
*** loop 143 ***
Average squared error = 0.25494, average error: -0.00807278
*** loop 144 ***
Average squared error = 0.254944, average error: -0.00807379
*** loop 145 ***
Average squared error = 0.254885, average error: -0.0080535
*** loop 146 ***
Average squared error = 0.254837, average error: -0.00803103
*** loop 147 ***
Average squared error = 0.254814, average error: -0.00799901
*** loop 148 ***
Average squared error = 0.254806, average error: -0.00799629
*** loop 149 ***
Average squared error = 0.2548, average error: -0.0079941
*** loop 150 ***
Average squared error = 0.254776, average error: -0.00797947
*** loop 151 ***
Average squared error = 0.254771, average error: -0.00797405
*** loop 152 ***
Average squared error = 0.254746, average error: -0.0079654
*** loop 153 ***
Average squared error = 0.254724, average error: -0.00795639
*** loop 154 ***
Average squared error = 0.254699, average error: -0.0079408
*** loop 155 ***
Average squared error = 0.254636, average error: -0.0079139
*** loop 156 ***
Average squared error = 0.254568, average error: -0.00787785
*** loop 157 ***
Average squared error = 0.254525, average error: -0.00784813
*** loop 158 ***
Average squared error = 0.254369, average error: -0.00776553
*** loop 159 ***
Average squared error = 0.254215, average error: -0.0076815
*** loop 160 ***
Average squared error = 0.254138, average error: -0.00763075
*** loop 161 ***
Average squared error = 0.254019, average error: -0.00756259
*** loop 162 ***
Average squared error = 0.253929, average error: -0.00751232
*** loop 163 ***
Average squared error = 0.253854, average error: -0.00746892
*** loop 164 ***
Average squared error = 0.253793, average error: -0.00743709
*** loop 165 ***
Average squared error = 0.253723, average error: -0.00739672
*** loop 166 ***
Average squared error = 0.253581, average error: -0.00732856
*** loop 167 ***
Average squared error = 0.253574, average error: -0.00732363
*** loop 168 ***
Average squared error = 0.253507, average error: -0.00729212
*** loop 169 ***
Average squared error = 0.253487, average error: -0.00728301
*** loop 170 ***
Average squared error = 0.253473, average error: -0.0072775
*** loop 171 ***
Average squared error = 0.253474, average error: -0.00726942
*** loop 172 ***
Average squared error = 0.25347, average error: -0.00727054
*** loop 173 ***
Average squared error = 0.253469, average error: -0.00726697
*** loop 174 ***
Average squared error = 0.253457, average error: -0.00726471
*** loop 175 ***
Average squared error = 0.253392, average error: -0.00723937
*** loop 176 ***
Average squared error = 0.253359, average error: -0.00722755
*** loop 177 ***
Average squared error = 0.25335, average error: -0.00722365
*** loop 178 ***
Average squared error = 0.253339, average error: -0.00721831
*** loop 179 ***
Average squared error = 0.253538, average error: -0.00723501
*** loop 180 ***
Average squared error = 0.253541, average error: -0.0072366
*** loop 181 ***
Average squared error = 0.253536, average error: -0.0072361
*** loop 182 ***
Average squared error = 0.253528, average error: -0.00723492
*** loop 183 ***
Average squared error = 0.253508, average error: -0.00723009
*** loop 184 ***
Average squared error = 0.253493, average error: -0.00722341
*** loop 185 ***
Average squared error = 0.253485, average error: -0.00722269
*** loop 186 ***
Average squared error = 0.253462, average error: -0.00721511
*** loop 187 ***
Average squared error = 0.253452, average error: -0.00721043
*** loop 188 ***
Average squared error = 0.253456, average error: -0.00721228
*** loop 189 ***
Average squared error = 0.253466, average error: -0.00721536
*** loop 190 ***
Average squared error = 0.253458, average error: -0.00721122
*** loop 191 ***
Average squared error = 0.253469, average error: -0.00721441
*** loop 192 ***
Average squared error = 0.253477, average error: -0.00721751
*** loop 193 ***
Average squared error = 0.253482, average error: -0.00722042
*** loop 194 ***
Average squared error = 0.253482, average error: -0.00722156
*** loop 195 ***
Average squared error = 0.253482, average error: -0.00722296
*** loop 196 ***
Average squared error = 0.253481, average error: -0.00722378
*** loop 197 ***
Average squared error = 0.25348, average error: -0.00722574
*** loop 198 ***
Average squared error = 0.253476, average error: -0.00722573
*** loop 199 ***
Average squared error = 0.253473, average error: -0.00722449

可以看出前10次效果显著,10次时候速度下降。

2.2 RGB-D稠密建图

  1. RGB-D稠密建图是一种利用RGB图像和深度图像进行三维重建的技术。与传统的基于三角化的稀疏重建方法不同,RGB-D稠密建图可以生成全局一致的稠密三维模型,包括物体的细节和形状。该技术已广泛应用于机器人导航、虚拟现实、增强现实和医疗领域等。

  2. RGB-D稠密建图的基本流程包括:采集RGB和深度图像、点云生成、稠密重建和纹理映射。其中,点云生成是将RGB图像和深度图像转换为三维点云数据,稠密重建是将点云数据转换为三维模型,纹理映射则是将RGB图像映射到三维模型表面,使得模型具有真实感和逼真度。

  3. RGB-D稠密建图的优点是可以快速地生成高质量的三维模型,并且可以捕捉物体的表面细节和形态信息。不过,由于对图像质量和标定精度要求较高,该技术在实际应用中还需要进一步的改进和完善。

2.3 点云地图

在build中执行语句:

cd dense_RGBD
 ./pointcloud_mapping

运行结果:

正在将图像转换为点云...
转换图像中: 1
转换图像中: 2
转换图像中: 3
转换图像中: 4
转换图像中: 5
点云共有1309800个点.
滤波之后,点云共有31876个点.

同时生成一个map.pcd文件,此文件的位置在:

/home/fighter/slam/slambook2/ch12/build/dense_RGBD/ map.pcd

可以用通过以下命令来查看map.pcd文件:

 pcl_viewer map.pcd

体素滤波之后的点云,可以看到运行结果如下,这是ICL-NUIM五张图像重建的结果:
滚轮放大后查看:
大
滚论滑动变小后查看:
小
同时,终端也会输出对应信息:

The viewer window provides interactive commands; for help, press 'h' or 'H' from within the window.
> Loading map.pcd [PCLVisualizer::setUseVbos] Has no effect when OpenGL version is ≥ 2
[done, 378.775 ms : 31876 points]
Available dimensions: x y z rgb

2.4 从点云重建网格

在build中执行语句:

cd dense_RGBD
./surfel_mapping map.pcd

运行结果:
结果时从点云重建得到的表面和网格模型,图像如下
结果时从点云重建得到的表面和网格模型,图像如下
同时终端输出信息:

point cloud loaded, points: 31876
computing normals ...
computing mesh ...
display mesh ...

2.5 八叉树地图

在build中执行语句:

cd dense_RGBD
 ./octomap_mapping

运行结果:
终端输出:

正在将图像转换为 Octomap ...
转换图像中: 1
转换图像中: 2
转换图像中: 3
转换图像中: 4
转换图像中: 5
saving octomap ...
Writing 1136665 nodes to output stream... done.

运行生成文件octomap.bt,使用以下命令来查看文件:

 octovis octomap.bt

终端输出:

Reading binary octree type OcTree

八叉树地图在不同分辨率的图像如下所示
0.05m分辨率
0.1m分辨率

3. 遇到的问题及解决办法

3.1 cmake …时,出现opencv版本问题

出现的错误:

CMake Error at dense_mono/CMakeLists.txt:11 (find_package):
  Could not find a configuration file for package "OpenCV" that is compatible
  with requested version "3.1".

  The following configuration files were considered but not accepted:

    /usr/local/lib/cmake/opencv4/OpenCVConfig.cmake, version: 4.5.0
    /usr/lib/x86_64-linux-gnu/cmake/opencv4/OpenCVConfig.cmake, version: 4.2.0
    /lib/x86_64-linux-gnu/cmake/opencv4/OpenCVConfig.cmake, version: 4.2.0

原因:
CMakeLists.txt中,设置的opencv的版本有问题;
出现此种问题主要是代码中的opencv的版本和自己当前安装的版本不同。

解决办法:
直接和之前的解决办法一样,更改CMakeLists.txt文件中的opencv版本即可。

//更改前:
find_package(OpenCV 3 REQUIRED)
//更改后:
find_package(OpenCV REQUIRED)

3.2 make -j8时,出现一些错误,有关PCL和opencv版本的问题。

  1. 出现的问题:

未定义标识符 “CV_GRAY2BGR”

在这里插入图片描述

原因:
这是因为此语句和opencv版本不相同。
解决办法:
更改dense_mapping.cpp头文件,添加以下头文件:

//添加头文件
#include <opencv2/imgproc/types_c.h>

有关opencv版本和语句问题的报错的锦集可以参考文章:https://blog.csdn.net/qq_44164791/article/details/131210608?spm=1001.2014.3001.5502

  1. 出现的问题:

出现的问题:
在make时,出现了刷屏的红色错误,这里展示两段:

/usr/include/pcl-1.10/pcl/pcl_config.h:7:4: error: #error PCL requires C++14 or above
    7 |   #error PCL requires C++14 or above
      |    ^~~~~
In file included from /usr/include/pcl-1.10/pcl/pcl_macros.h:77,
                 from /usr/include/pcl-1.10/pcl/point_types.h:42,
                 from /home/fighter/slam/slambook2/ch12/dense_RGBD/pointcloud_mapping.cpp:10:
/usr/include/pcl-1.10/pcl/pcl_config.h:7:4: error: #error PCL requires C++14 or above
    7 |   #error PCL requires C++14 or above
      |    ^~~~~
In file included from /usr/include/pcl-1.10/pcl/console/print.h:44,
                 from /usr/include/pcl-1.10/pcl/conversions.h:53,
                 from /usr/include/pcl-1.10/pcl/common/io.h:48,
                 from /usr/include/pcl-1.10/pcl/io/file_io.h:41,
                 from /usr/include/pcl-1.10/pcl/io/pcd_io.h:44,
                 from /home/fighter/slam/slambook2/ch12/dense_RGBD/surfel_mapping.cpp:7:
/usr/include/pcl-1.10/pcl/pcl_config.h:7:4: error: #error PCL requires C++14 or above
    7 |   #error PCL requires C++14 or above
      |    ^~~~~
In file included from /usr/include/pcl-1.10/pcl/console/print.h:44,
                 from /usr/include/pcl-1.10/pcl/conversions.h:53,
                 from /usr/include/pcl-1.10/pcl/common/io.h:48,
                 from /usr/include/pcl-1.10/pcl/io/file_io.h:41,
                 from /usr/include/pcl-1.10/pcl/io/pcd_io.h:44,
                 from /home/fighter/slam/slambook2/ch12/dense_RGBD/pointcloud_mapping.cpp:11:
/usr/include/pcl-1.10/pcl/pcl_config.h:7:4: error: #error PCL requires C++14 or above
    7 |   #error PCL requires C++14 or above
      |    ^~~~~

在这里插入图片描述
在这里插入图片描述
原因:
最主要的原因时因为C++版本的问题

解决办法:
将含有C++版本设置语句的CMakeLists.txt文件中有关其版本,全部改为14以上。
然后,make时会出现部分警告,当时不影响程序结果。
在这里插入图片描述

3.3 cmake …时,会出现vtk的问题,

出现的问题:

The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "pvtk" references the file
   "/usr/bin/pvtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

解决办法:
创建两个软链接:
第一个软链接:

sudo ln -s /usr/lib/python2.7/dist-packages/vtk/libvtkRenderingPythonTkWidgets.x86_64-linux-gnu.so /usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so

第二个软链接:

sudo ln -s /usr/bin/vtk7 /usr/bin/vtk 

3.4 运行 ./dense_mapping /home/fighter/slam/slambook2/ch12/test_data时,出现段错误

出现的错误:

 ./dense_mapping /home/fighter/slam/slambook2/ch12/test_data
read total 202 files.
*** loop 1 ***
Segmentation fault

原因:
Segmentation fault (core dumped)多为内存不当操作造成。空指针、野指针的读写操作,数组越界访问,破坏常量等。如最近的势能图代码中的链表操作,对链表的新增和释放包括赋值等等,如出现不当操作都有可能造成程序崩溃。对每个指针声明后进行初始化为NULL是避免这个问题的好办法。排除此问题的最好办法则是调试。

解决办法:
将文件dense_mapping.cpp中update函数为定义为bool类型,但是没有返回值,可以改为void。
更改前,例其中一处:
在这里插入图片描述

更改后,例其中一处:

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/664291.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

使用腾讯云服务器从零搭建个人网站

前期准备工作 1.服务器重装系统 选择ubuntu18的系统镜像 2.开放端口 需要开放80&#xff0c;27017&#xff0c;3000&#xff0c;22端口 80端口用于配置nginx服务27017端口用于连接mongondb数据库3000端口是启动项目的端口22端口用于ssh远程连接服务器&#xff0c;一般默认会…

SpringBoot - @Transactional注解详解

简介 Spring中的Transactional注解&#xff0c;基于动态代理的机制&#xff0c;提供了一种透明的事务管理机制&#xff0c;方便快捷的解决在开发中碰到的问题&#xff0c;Transactional 的事务开启 &#xff0c;或者是基于接口的或者是基于类的代理被创建。Spring为了更好的支…

数据库SQL查询(二)之连接查询

本文介绍SQL查询&#xff0c;如何在海量数据中筛选想要数据&#xff1b; 数据库管理系统选择&#xff1a;关系型数据库mysql 数据库管理工具选择&#xff1a;navicat 本文中查询语句和查询案例参考自&#xff1a;https://edu.csdn.net/course/detail/27673?ops_request_mis…

python django vue httprunner 实现接口自动化平台(最终版)

一、项目介绍&#xff1a; 1.1 项目地址 前端地址&#xff1a; GitHub - 18713341733/test_platform_service: django vue 实现接口自动化平台 后端地址&#xff1a; GitHub - 18713341733/test_platform_front: Django vue实现接口自动化平台 1.2 项目介绍 1.2.1 环境…

在 K8S 中部署一个应用 上

本身在 K8S 中部署一个应用是需要写 yaml 文件的&#xff0c;我们这次简单部署&#xff0c;通过拉取网络上的镜像来部署应用&#xff0c;会用图解的方式来分享一下&#xff0c;过程中都发生了什么 简单部署一个程序 我们可以通过 kubectl run 的方式来简单部署一个应用&#…

Python深度学习027:什么是梯度、梯度消失、梯度爆炸以及如何解决

文章目录 1. 梯度的概念2. 梯度更新中存在的问题2.1 梯度消失2.2 梯度爆炸3. 解决办法3.1 梯度消失3.2 梯度爆炸1. 梯度的概念 在机器学习中,梯度是指一个多元函数在某一点处的变化率以及变化的方向。 对于一个参数化的函数,梯度可以告诉我们在一个特定的点处函数值增加最快…

分布式系统概念和设计——Mach实例研究

分布式系统概念和设计 Mach实例研究 Mach主要抽象概述 任务 一个Mach任务是一个执行环境主要包括一个被保护的地址空间和一个内存管理的权能集合这些权能主要用于访问端口 线程 任务可以包含多个线程在共享内存的多处理器中&#xff0c;属于同一个任务的线程可以在不同的处理…

【案例实战】SpringBoot整合Redis实现缓存分页数据查询

正式观看本文之前&#xff0c;设想一个问题&#xff0c;高并发情况下&#xff0c;首页列表数据怎么做&#xff1f; 类似淘宝首页&#xff0c;这些商品是从数据库中查出来的吗&#xff1f;答案肯定不是&#xff0c;在高并发的情况下&#xff0c;数据库是扛不住的&#xff0c;那么…

Java解析XML文件(DOM4J解析xml文件)

内容重点1&#xff1a;DOM4J创建、解析、修改XML文件 内容重点2&#xff1a;DOM4J模拟解析web.xml配置文件&#xff0c;实现实例化servlet 1、什么是xml Xml(Extensible Markup Language) 一种扩展性标示语言,出现的意义其实与JSON字符串的意义相似,是新一代的数据交换标准…

怎么加密共享文件夹?局域网共享文件夹加密方法

相信很多企业都在使用局域网共享文件夹&#xff0c;它可以很方便地实现各部门之间的沟通协作。但是由于使用人员众多&#xff0c;数据安全非常难以得到保障。那么我们该怎么加密局域网共享文件夹呢&#xff1f; 共享文件夹加密 首先&#xff0c;我们先来了解一下共享文件夹加密…

某农业大学数据结构A-第13周作业

1.拓扑排序 【问题描述】 拓扑排序的流程如下&#xff1a; 1. 在有向图中选一个没有前驱的顶点并且输出之&#xff1b; 2. 从图中删除该顶点和所有以它为尾的弧。 重复上述两步&#xff0c;直至全部顶点均已输出&#xff0c;或者当前图中不存在无前驱的顶点为止。后一种情况则…

渲染模式差异和选择

传统服务端渲染 在过去传统开发中&#xff0c;页面渲染任务是由服务端完成的&#xff0c;服务器负责获取数据&#xff0c;拼装页面&#xff0c;客户端仅负责内容显示&#xff0c;使用这种方式的典型技术有 JSP、PHP、ASP.NET 等等。 客户端渲染 CSR Vue.js、React 这类框架之…

专访蘑菇物联沈国辉:做工业AI时代的推动者

在中国制造迈向高质量发展的进程中&#xff0c;数智化转型会成为破局之道。在这其中&#xff0c;蘑菇物联除了是一个本分的答题者&#xff0c;还是一个善于发现问题的贡献者。 作者|思杭 编辑|皮爷 出品|产业家 从广州造纸厂到广州造船厂&#xff0c;从第一橡胶厂到电池厂&a…

利用R语言通过百度地图API进行批量地理编码

利用R语言通过百度地图API进行批量地理编码 当您有大量的地点名称需要在地图上来呈现时&#xff0c;首先要在在线地图上找到该地址的坐标&#xff0c;通常是指经纬度&#xff0c;如果能够用代码来实现&#xff0c;便少了许多费时费力的体力活儿&#xff0c;以下将详细介绍地理…

数据结构的一些总结---利用Python实现

大家好&#xff0c;我是北山啦&#xff0c;本文简单介绍Python数据结构的相关内容&#xff0c;简单就是很简单的那种 文章目录 查找线性查找 O(n)二分查找(Binary Search) O(logn) 排序排序Low B三人组冒泡排序选择排序插入排序 排序NB三人组快速排序归并排序 数据结构栈和队列…

[Day 3 of 17]Building a document scanner in OpenCV

a computer vision-powered document scanner 计算机视觉驱动的文档扫描仪&#xff0c;三个步骤&#xff1a; 边缘检测edges通过边缘&#xff0c;找到代表待扫描纸张的轮廓contour应用透视转换(a perspective transform)获得文档自上而下的视图 How to Build a Kick-Ass Mob…

录音转文字的方法有哪些?这三个录音转文字的方法有哪些

你是否曾经遇到过这样的场景&#xff1a;在开会或者采访时&#xff0c;需要记录重要信息&#xff0c;但是手写记录或打字速度跟不上对话节奏&#xff0c;甚至难以记录所有细节。此时&#xff0c;录音转文字软件就派上用场了。然而&#xff0c;市场上有太多种选择&#xff0c;到…

【Vue3 生态】Vue Router 路由知识概览

前言 在 Web 前端开发中&#xff0c;路由是非常重要的一环&#xff0c;但是路由到底是什么呢&#xff1f; 从路由的用途上讲 路由是指随着浏览器地址栏的变化&#xff0c;展示给用户不同的页面。 从路由的实现原理上讲 路由是URL到函数的映射。它将 URL 和应用程序的不同部分…

低代码平台——提高研发效率的神器

一、前言 听起来像是一个噱头&#xff0c;但是低代码确实是一个能够快速提高研发效率的神器。 通过使用低代码平台&#xff0c;研发人员可以节省好几个月的时间&#xff0c;将前后端各种功能可视化以搭积木的形式快速完成。今天&#xff0c;我们将深入探讨低代码开发平台的特点…

两阶段目标检测指南:R-CNN、FPN、Mask R-CNN

动动发财的小手&#xff0c;点个赞吧&#xff01; Source[1] 多阶段&#xff08;Two-stage&#xff09;物体检测 计算机视觉中最基本和最广泛研究的挑战之一是目标检测。该任务旨在在给定图像中绘制多个对象边界框&#xff0c;这在包括自动驾驶在内的许多领域非常重要。通常&am…