视觉SLAM十四讲——ch7实践(视觉里程计1)

news2024/11/28 10:56:26

视觉SLAM十四讲----ch7的实践操作及避坑

  • 1. 实践操作前的准备工作
  • 2. 实践过程
    • 2.1 特征提取与匹配
    • 2.2 对极几何
    • 2.3 三角测量
    • 2.4 求解PnP
    • 2.5 求解ICP
  • 3. 遇到的问题
    • 3.1 准备工作遇到的问题

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

  1. 在终端中进入ch7文件夹下,顺序执行以下命令进行编译。
mkdir build
cd build
cmake ..
//注意,j8还是其他主要看自己的电脑情况
make -j8
  1. 在build文件中进行运行。
    注意: 在make的过程中可能会有一些警告,不过不会对最后造成影响。

2. 实践过程

2.1 特征提取与匹配

1. OpenCV的ORB特征
在build中执行语句: ./orb_cv /home/fighter/slam/slambook2/ch7/1.png /home/fighter/slam/slambook2/ch7/2.png(注意:为了避免不必要的麻烦,建议直接使用绝对路径
值得注意的是:这里的图像参数是在终端传入,如果不想传入也可以修改代码,通过代码直接获得。
运行结果:
ORB特征提取
特征匹配,效果较好的和所有的
在窗口显示的同时,终端输出以下信息:

extract ORB cost = 0.194423 seconds.
match ORB cost = 0.03702 seconds.
-- Max dist : 94.000000
-- Min dist : 4.000000

2. 手写ORB特征
在build中执行语句:./orb_self (注意:如果运行有误,找不到图片,记的去orb_self.cpp文件中更改图片路径
运行结果:
匹配点
与此同时,终端输出一些特征匹配的信息:

bad/total: 43/638
bad/total: 8/595
extract ORB cost = 0.0047491 seconds.
match ORB cost = 0.0013752 seconds.
matches: 41
done.

可以看出,特征提取只用了4.7毫秒,匹配只用了1.3毫秒。

2.2 对极几何

在build中执行语句: ./pose_estimation_2d2d /home/fighter/slam/slambook2/ch7/1.png /home/fighter/slam/slambook2/ch7/2.png
运行结果:

-- Max dist : 94.000000
-- Min dist : 4.000000
一共找到了79组匹配点
fundamental_matrix is
[4.54443750398184e-06, 0.0001333855576992603, -0.01798499246479044;
 -0.0001275657012964255, 2.266794804645652e-05, -0.01416678429206633;
 0.01814994639971766, 0.004146055870980492, 1]
essential_matrix is
[-0.008455114492964278, 0.05451570701059781, 0.1546375809484052;
 -0.008287154708445212, 0.03351311565984172, -0.6896472136971504;
 -0.1153993974485718, 0.6945899967012867, 0.02159624094256633]
homography_matrix is
[0.9261214237658335, -0.1445322040802305, 33.26921164265664;
 0.04535424230636757, 0.9386696658342905, 8.570980713233848;
 -1.006198269424755e-05, -3.008140685985328e-05, 1]
R is
[0.9956584940813579, -0.05615340406690447, 0.07423582945816433;
 0.05268846331440004, 0.9974645001566195, 0.04783823534446425;
 -0.07673388428334535, -0.0437191735855581, 0.9960926386957119]
t is
[-0.9726703113454949;
 -0.2153829834753195;
 0.08673313009645391]
t^R=
[0.01195733758736675, -0.07709685221674556, -0.2186905642298021;
 0.01171980658216709, -0.04739470268352609, 0.9753084428633267;
 0.1631993929614534, -0.9822985936236425, -0.03054169683725466]
epipolar constraint = [-0.0005617285518606241]
epipolar constraint = [0.002891683190146016]
epipolar constraint = [-0.0001941259398173245]
epipolar constraint = [0.003462947761727536]
epipolar constraint = [8.120001470268701e-06]
epipolar constraint = [0.002710644239222917]
epipolar constraint = [-0.001869251694575136]
epipolar constraint = [0.00139456385994044]
epipolar constraint = [0.001761227647336161]
epipolar constraint = [1.869571731462349e-06]
epipolar constraint = [-0.004004668139513667]
epipolar constraint = [0.002638369853227809]
epipolar constraint = [4.71865360582302e-06]
epipolar constraint = [0.002768559038208648]
epipolar constraint = [0.001230260274886132]
epipolar constraint = [-9.947439380264544e-07]
epipolar constraint = [-0.0002841959014567297]
epipolar constraint = [0.001139813094577335]
epipolar constraint = [0.002209250772744531]
epipolar constraint = [0.002850233510438394]
epipolar constraint = [-0.0009898447085951168]
epipolar constraint = [-5.94020961628694e-05]
epipolar constraint = [0.001896654223267416]
epipolar constraint = [0.001705775496444906]
epipolar constraint = [7.876819478169761e-06]
epipolar constraint = [-0.0001806518038049848]
epipolar constraint = [0.003204291493829357]
epipolar constraint = [-0.0006467971601622075]
epipolar constraint = [-0.0008445761906836491]
epipolar constraint = [-0.0002847958262359729]
epipolar constraint = [0.001126554642501526]
epipolar constraint = [0.001484320538271348]
epipolar constraint = [-0.002115865517619359]
epipolar constraint = [0.004033028487439499]
epipolar constraint = [0.000665497431603157]
epipolar constraint = [0.0005557219318915591]
epipolar constraint = [0.0007972861772887335]
epipolar constraint = [-0.001440067047765337]
epipolar constraint = [0.0003964624006285444]
epipolar constraint = [-0.0003556864447603059]
epipolar constraint = [0.001175277405117692]
epipolar constraint = [-0.001470809843158782]
epipolar constraint = [-0.0007155680024874544]
epipolar constraint = [0.003041807422365872]
epipolar constraint = [-0.000355171981926361]
epipolar constraint = [-7.065871935545143e-05]
epipolar constraint = [0.001191022361631378]
epipolar constraint = [-0.0007055167484525393]
epipolar constraint = [0.0004088281809971096]
epipolar constraint = [-0.000892980090616162]
epipolar constraint = [0.001026346981193374]
epipolar constraint = [0.001502989651308746]
epipolar constraint = [-0.001131199458784926]
epipolar constraint = [-0.003495250951856245]
epipolar constraint = [-0.0002070785253527191]
epipolar constraint = [0.0004211619083240026]
epipolar constraint = [0.004030229295353918]
epipolar constraint = [0.002423184222031846]
epipolar constraint = [-0.001799922916276332]
epipolar constraint = [0.00214236066535746]
epipolar constraint = [-0.001604766538417207]
epipolar constraint = [-0.00156708990112403]
epipolar constraint = [-0.002429487992740217]
epipolar constraint = [0.000401189111909464]
epipolar constraint = [-0.001494836576249617]
epipolar constraint = [-0.0003175435711454538]
epipolar constraint = [-0.007289352381657122]
epipolar constraint = [-0.003396636093576003]
epipolar constraint = [-0.004063091392346646]
epipolar constraint = [-0.00269429995497647]
epipolar constraint = [-0.003170213468765316]
epipolar constraint = [0.001227259432891176]
epipolar constraint = [-0.001403642253683501]
epipolar constraint = [0.006666696972492035]
epipolar constraint = [0.005653889777384447]
epipolar constraint = [0.0008830143247820065]
epipolar constraint = [-0.001103292290051336]
epipolar constraint = [-0.003982708195313309]
epipolar constraint = [-0.0053874915375101]

2.3 三角测量

在build中执行语句: ./triangulation /home/fighter/slam/slambook2/ch7/1.png /home/fighter/slam/slambook2/ch7/2.png

运行结果:
两个对比图
运行的同时,终端会输出:

-- Max dist : 94.000000
-- Min dist : 4.000000
一共找到了79组匹配点
depth: 8.95119
depth: 8.06918
depth: 10.3294
depth: 8.6317
depth: 8.17645
depth: 7.37573
depth: 11.8396
depth: 8.05226
depth: 8.08888
depth: 8.92732
depth: 8.17315
depth: 7.03846
depth: 8.17768
depth: 7.93303
depth: 9.0064
depth: 10.0725
depth: 12.2046
depth: 12.348
depth: 7.31126
depth: 8.03819
depth: 8.11742
depth: 8.80592
depth: 7.29207
depth: 10.3618
depth: 8.15175
depth: 8.25446
depth: 9.02341
depth: 7.1761
depth: 10.0498
depth: 10.0789
depth: 8.20269
depth: 8.74983
depth: 8.19139
depth: 8.55992
depth: 8.14039
depth: 7.13569
depth: 7.10316
depth: 11.8327
depth: 8.07921
depth: 10.1274
depth: 10.2183
depth: 11.9348
depth: 8.01726
depth: 8.23094
depth: 8.88643
depth: 8.25303
depth: 8.73167
depth: 8.71261
depth: 9.22772
depth: 8.76106
depth: 8.31465
depth: 8.92808
depth: 10.2404
depth: 8.44863
depth: 9.06756
depth: 8.10639
depth: 8.40526
depth: 8.74884
depth: 8.92165
depth: 9.13693
depth: 7.0544
depth: 8.8007
depth: 7.85402
depth: 8.72166
depth: 9.82223
depth: 10.5516
depth: 6.73889
depth: 8.60173
depth: 6.64584
depth: 6.66798
depth: 8.73605
depth: 8.18344
depth: 9.19246
depth: 8.94078
depth: 9.11707
depth: 8.76513
depth: 8.22164
depth: 7.17891
depth: 8.70631

2.4 求解PnP

在build中执行语句: ./pose_estimation_3d2d /home/fighter/slam/slambook2/ch7/1.png /home/fighter/slam/slambook2/ch7/2.png /home/fighter/slam/slambook2/ch7/1_depth.png /home/fighter/slam/slambook2/ch7/2_depth.png (注意:这里的参数是四个,两张图片,两张对应的深度图片
运行结果:

-- Max dist : 94.000000
-- Min dist : 4.000000
一共找到了79组匹配点
3d-2d pairs: 75
solve pnp in opencv cost time: 0.0552358 seconds.
R=
[0.9979059095501289, -0.05091940089111062, 0.03988747043647115;
 0.04981866254254162, 0.9983623157438141, 0.02812094175381178;
 -0.04125404886071617, -0.02607491352889358, 0.9988083912027663]
t=
[-0.1267821389556796;
 -0.008439496817594587;
 0.06034935748886031]
calling bundle adjustment by gauss newton
iteration 0 cost=40517.7576706
iteration 1 cost=410.547029116
iteration 2 cost=299.76468142
iteration 3 cost=299.763574327
pose by g-n:
   0.997905909549  -0.0509194008562   0.0398874705187   -0.126782139096
   0.049818662505    0.998362315745   0.0281209417649 -0.00843949683874
 -0.0412540489424  -0.0260749135374    0.998808391199   0.0603493575229
                0                 0                 0                 1
solve pnp by gauss newton cost time: 0.0001665 seconds.
calling bundle adjustment by g2o
iteration= 0     chi2= 410.547029        time= 2.15e-05  cumTime= 2.15e-05       edges= 75       schur= 0
iteration= 1     chi2= 299.764681        time= 1.26e-05  cumTime= 3.41e-05       edges= 75       schur= 0
iteration= 2     chi2= 299.763574        time= 1.19e-05  cumTime= 4.6e-05        edges= 75       schur= 0
iteration= 3     chi2= 299.763574        time= 1.14e-05  cumTime= 5.74e-05       edges= 75       schur= 0
iteration= 4     chi2= 299.763574        time= 1.23e-05  cumTime= 6.97e-05       edges= 75       schur= 0
iteration= 5     chi2= 299.763574        time= 1.36e-05  cumTime= 8.33e-05       edges= 75       schur= 0
iteration= 6     chi2= 299.763574        time= 1.13e-05  cumTime= 9.46e-05       edges= 75       schur= 0
iteration= 7     chi2= 299.763574        time= 1.23e-05  cumTime= 0.0001069      edges= 75       schur= 0
iteration= 8     chi2= 299.763574        time= 1.14e-05  cumTime= 0.0001183      edges= 75       schur= 0
iteration= 9     chi2= 299.763574        time= 1.28e-05  cumTime= 0.0001311      edges= 75       schur= 0
optimization costs time: 0.001120401 seconds.
pose estimated by g2o =
    0.99790590955  -0.0509194008911   0.0398874704367   -0.126782138956
  0.0498186625425    0.998362315744   0.0281209417542 -0.00843949681823
 -0.0412540488609  -0.0260749135293    0.998808391203   0.0603493574888
                0                 0                 0                 1
solve pnp by g2o cost time: 0.001277401 seconds.

2.5 求解ICP

在build中执行语句: ./pose_estimation_3d3d /home/fighter/slam/slambook2/ch7/1.png /home/fighter/slam/slambook2/ch7/2.png /home/fighter/slam/slambook2/ch7/1_depth.png /home/fighter/slam/slambook2/ch7/2_depth.png
运行结果:

  • 以calling bundle adjustment为界,calling bundle adjustment上面的运行结果是用SVD方法来求解的,calling bundle adjustment以下是非线性优化方法。
-- Max dist : 94.000000
-- Min dist : 4.000000
一共找到了79组匹配点
3d-3d pairs: 72
W=  10.871 -1.01948  2.54771
-2.16033  3.85307 -5.77742
 3.94738 -5.79979  9.62203
U=  0.558087  -0.829399 -0.0252034
 -0.428009  -0.313755   0.847565
  0.710878   0.462228   0.530093
V=  0.617887  -0.784771 -0.0484806
 -0.399894  -0.366747   0.839989
  0.676979   0.499631   0.540434
ICP via SVD results:
R = [0.9969452351705235, 0.0598334759429696, -0.05020112774999549;
 -0.05932607556034211, 0.9981719680327525, 0.01153858709846634;
 0.05079975225724825, -0.008525103530306, 0.9986724727258676]
t = [0.1441598281917405;
 -0.06667849447794799;
 -0.03009747343724256]
R_inv = [0.9969452351705235, -0.05932607556034211, 0.05079975225724825;
 0.0598334759429696, 0.9981719680327525, -0.008525103530306;
 -0.05020112774999549, 0.01153858709846634, 0.9986724727258676]
t_inv = [-0.1461462830262246;
 0.0576744363694081;
 0.03806387978797152]
calling bundle adjustment
iteration= 0     chi2= 1.816112  time= 2.33e-05  cumTime= 2.33e-05       edges= 72       schur= 0        lambda= 0.000758        levenbergIter= 1
iteration= 1     chi2= 1.815514  time= 2.02e-05  cumTime= 4.35e-05       edges= 72       schur= 0        lambda= 0.000505        levenbergIter= 1
iteration= 2     chi2= 1.815514  time= 1.24e-05  cumTime= 5.59e-05       edges= 72       schur= 0        lambda= 0.000337        levenbergIter= 1
iteration= 3     chi2= 1.815514  time= 1.09e-05  cumTime= 6.68e-05       edges= 72       schur= 0        lambda= 0.000225        levenbergIter= 1
iteration= 4     chi2= 1.815514  time= 2.02e-05  cumTime= 8.7e-05        edges= 72       schur= 0        lambda= 0.000150        levenbergIter= 1
iteration= 5     chi2= 1.815514  time= 1.91e-05  cumTime= 0.0001061      edges= 72       schur= 0        lambda= 0.000299        levenbergIter= 1
optimization costs time: 0.000488299 seconds.

after optimization:
T=
  0.996945  0.0598335 -0.0502011    0.14416
-0.0593261   0.998172  0.0115386 -0.0666785
 0.0507998 -0.0085251   0.998672 -0.0300979
         0          0          0          1
p1 = [-0.243698, -0.117719, 1.5848]
p2 = [-0.297211, -0.0956614, 1.6558]
(R*p2+t) = [-0.2409901495364605;
 -0.1254270500587826;
 1.609221205029395]

p1 = [0.402045, -0.341821, 2.2068]
p2 = [0.378811, -0.262859, 2.2196]
(R*p2+t) = [0.3946591022539743;
 -0.3259188829495218;
 2.20803983035825]

p1 = [-0.522843, -0.214436, 1.4956]
p2 = [-0.58581, -0.208584, 1.6052]
(R*p2+t) = [-0.532923946912698;
 -0.2216052393093164;
 1.54499035805527]

p1 = [-0.627753, 0.160186, 1.3396]
p2 = [-0.709645, 0.159033, 1.4212]
(R*p2+t) = [-0.6251478068660965;
 0.1505624195985039;
 1.351809862638435]

p1 = [0.594266, -0.0256024, 1.5332]
p2 = [0.514795, 0.0391393, 1.5332]
(R*p2+t) = [0.582755696243957;
 -0.04046060384335358;
 1.526884519595548]

3. 遇到的问题

3.1 准备工作遇到的问题

  1. 问题: 再cmake …过程中出现以下错误:
CMake Error at CMakeLists.txt:9 (find_package):
  Could not find a configuration file for package "OpenCV" that is compatible
  with requested version "3".

  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

解决办法:
出现此种问题主要是代码中的opencv的版本和自己当前安装的版本不同,更改CMakeLists.txt文件中的opencv版本即可。

//更改前:
find_package(OpenCV 3 REQUIRED)
//更改后:
find_package(OpenCV REQUIRED)
  1. 问题: make -j8时出现以下错误
/home/fighter/slam/slambook2/ch7/pose_estimation_2d2d.cpp: In function ‘int main(int, char**)’:
/home/fighter/slam/slambook2/ch7/pose_estimation_2d2d.cpp:36:31: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
   36 |   Mat img_1 = imread(argv[1], CV_LOAD_IMAGE_COLOR);
      |                               ^~~~~~~~~~~~~~~~~~~
/home/fighter/slam/slambook2/ch7/pose_estimation_2d2d.cpp: In function ‘void pose_estimation_2d2d(std::vector<cv::KeyPoint>, std::vector<cv::KeyPoint>, std::vector<cv::DMatch>, cv::Mat&, cv::Mat&)’:
/home/fighter/slam/slambook2/ch7/pose_estimation_2d2d.cpp:143:61: error: ‘CV_FM_8POINT’ was not declared in this scope
  143 |   fundamental_matrix = findFundamentalMat(points1, points2, CV_FM_8POINT);
      |                                                             ^~~~~~~~~~~~
make[2]: *** [CMakeFiles/pose_estimation_2d2d.dir/build.make:63: CMakeFiles/pose_estimation_2d2d.dir/pose_estimation_2d2d.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/pose_estimation_2d2d.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/home/fighter/slam/slambook2/ch7/triangulation.cpp: In function ‘int main(int, char**)’:
/home/fighter/slam/slambook2/ch7/triangulation.cpp:44:31: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
   44 |   Mat img_1 = imread(argv[1], CV_LOAD_IMAGE_COLOR);
      |                               ^~~~~~~~~~~~~~~~~~~
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp: In member function ‘virtual bool VertexPose::read(std::istream&)’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp:59:44: warning: no return statement in function returning non-void [-Wreturn-type]
   59 |   virtual bool read(istream &in) override {}
      |                                            ^
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp: In member function ‘virtual bool VertexPose::write(std::ostream&) const’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp:61:52: warning: no return statement in function returning non-void [-Wreturn-type]
   61 |   virtual bool write(ostream &out) const override {}
      |                                                    ^
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp: In function ‘int main(int, char**)’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp:54:31: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
   54 |   Mat img_1 = imread(argv[1], CV_LOAD_IMAGE_COLOR);
      |                               ^~~~~~~~~~~~~~~~~~~
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp:64:28: error: ‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope
   64 |   Mat d1 = imread(argv[3], CV_LOAD_IMAGE_UNCHANGED);       // 深度图为16位无符号数,单通道图像
      |                            ^~~~~~~~~~~~~~~~~~~~~~~
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp: In member function ‘virtual bool EdgeProjectXYZRGBDPoseOnly::read(std::istream&)’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp:84:27: warning: no return statement in function returning non-void [-Wreturn-type]
   84 |   bool read(istream &in) {}
      |                           ^
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp: In member function ‘virtual bool EdgeProjectXYZRGBDPoseOnly::write(std::ostream&) const’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp:86:35: warning: no return statement in function returning non-void [-Wreturn-type]
   86 |   bool write(ostream &out) const {}
      |                                   ^
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp: In function ‘int main(int, char**)’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp:98:31: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
   98 |   Mat img_1 = imread(argv[1], CV_LOAD_IMAGE_COLOR);
      |                               ^~~~~~~~~~~~~~~~~~~
/home/fighter/slam/slambook2/ch7/pose_estimation_3d3d.cpp:107:32: error: ‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope
  107 |   Mat depth1 = imread(argv[3], CV_LOAD_IMAGE_UNCHANGED);       // 深度图为16位无符号数,单通道图像
      |                                ^~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/triangulation.dir/build.make:63: CMakeFiles/triangulation.dir/triangulation.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:113: CMakeFiles/triangulation.dir/all] Error 2
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp: In member function ‘virtual bool VertexPose::read(std::istream&)’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp:262:44: warning: no return statement in function returning non-void [-Wreturn-type]
  262 |   virtual bool read(istream &in) override {}
      |                                            ^
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp: In member function ‘virtual bool VertexPose::write(std::ostream&) const’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp:264:52: warning: no return statement in function returning non-void [-Wreturn-type]
  264 |   virtual bool write(ostream &out) const override {}
      |                                                    ^
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp: In member function ‘virtual bool EdgeProjection::read(std::istream&)’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp:298:44: warning: no return statement in function returning non-void [-Wreturn-type]
  298 |   virtual bool read(istream &in) override {}
      |                                            ^
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp: In member function ‘virtual bool EdgeProjection::write(std::ostream&) const’:
/home/fighter/slam/slambook2/ch7/pose_estimation_3d2d.cpp:300:52: warning: no return statement in function returning non-void [-Wreturn-type]
  300 |   virtual bool write(ostream &out) const override {}
      |                                                    ^
make[2]: *** [CMakeFiles/pose_estimation_3d3d.dir/build.make:63: CMakeFiles/pose_estimation_3d3d.dir/pose_estimation_3d3d.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:167: CMakeFiles/pose_estimation_3d3d.dir/all] Error 2
make[2]: *** [CMakeFiles/pose_estimation_3d2d.dir/build.make:63: CMakeFiles/pose_estimation_3d2d.dir/pose_estimation_3d2d.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/pose_estimation_3d2d.dir/all] Error 2

也就是下图所示:
make时出现的问题
问题原因: 出现此类问题主要是因为,CV_LOAD_IMAGE_COLOR 是 OpenCV 2.x 版本中使用的旧常量。
解决办法: 修改办法主要有两种,一种是添加头文件,另一种是修改代码。
办法一:添加头文件:#include <opencv2/imgcodecs/imgcodecs_c.h> 如果还是不行就试试这个(#include “opencv2/imgcodecs/legacy/constants_c.h”
办法二:在 OpenCV 3.x 及更高版本中,应该使用 IMREAD_COLOR 常量代替它。

注意1: 更多的有关opencv错误更改可参考以下文章:https://blog.csdn.net/qq_44164791/article/details/131210608?spm=1001.2014.3001.5501
注意2: 需要把所有报错的文件全部更改!!!

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

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

相关文章

Sentinel的限流和Gateway的限流差别?

Sentinel的限流与Gateway的限流有什么差别&#xff1f; 问题说明&#xff1a;考察对限流算法的掌握情况 限流算法常见的有三种实现&#xff1a;滑动时间窗口&#xff0c;令牌桶算法&#xff0c;漏桶算法。gateway则采用基于Redis实现的令牌桶算法。但是我们不会去用&#xff…

PCB做了盲埋孔,还有必要再做盘中孔工艺吗

一博高速先生成员--王辉东 初夏的西湖美艳无边&#xff0c;若不去看看人生总觉遗憾。 杭州两大美女明明和琪琪约好这个星期天&#xff0c;一起去西湖转转&#xff0c;到灵隐寺许个愿&#xff0c;再到北高峰爬个山。 话说两人正行之间&#xff0c;看到正对面也有两个美女结伴同…

Spring Security Oauth2.1 最新版 1.1.0 整合 gateway 完成授权认证(基于 springboot 3.1)

目录 背景 版本 Spring Boot 3.1 Spring Authorization Server 1.1.0官方文档 基础 spring security OAuth2.0 模块构成 授权方式 集成过程 官方demo 代码集成 依赖 授权服务AuthorizationServerConfig配置 重要组件 测试 查看授权服务配置 访问授权服务 授…

渗透测试与自动化安全测试工具比较

应用程序安全性并不新鲜&#xff0c;但它在需求、复杂性和深度方面正迅速增长。随着网络犯罪自疫情爆发以来增长了近600%&#xff0c;越来越多的SaaS企业开始争相保护他们的应用程序。即使那些运行最新端点保护的系统也面临重大漏洞。 然而随之而来的一个问题是&#xff1a;即…

【javaweb+springboot】旅游网页面设计(主购物车功能)——前后端分离+服务端客户端增删改查(完整代码+文档)

一、项目背景 由于疫情原因&#xff0c;张家界旅游业受到很大的影响&#xff0c;为了促进旅游业的发展&#xff0c;吸引更多游客来到张家界旅游&#xff0c;帮助游客更好地了解张家界&#xff0c;创建张家界旅游网&#xff0c;推进旅游发展大会的开展&#xff0c;展示当地风土人…

商城系统功能有哪些?

商城系统是一种以电子商务为基础的技术工具&#xff0c;为企业涉足电子商务提供了完整的解决方案。商城系统不仅可以帮助企业降低成本&#xff0c;提高效率&#xff0c;还可以实现全方位的在线营销&#xff0c;为企业争取更多的竞争优势&#xff0c;如SHOP、Magento等一系列成熟…

EBU5476 Microprocessor System Design 知识点总结_3 Assembly

Assembly 汇编语法。 顺序结构 label ; 可省略&#xff0c;用于跳转到此位置助记符 operand1, operand2, … ; CommentsMOV r1, #0x01 ; 数据0x01放入r1 MOV r1, #A ; 数据A的ascii码放入r1 MOV R0, R1 ; move R1 into R0 MOVS R0, R1 ; move R1 i…

当 GraphQL 遇上图数据库,便有了更方便查询数据的方式

人之初&#xff0c;性本鸽。 大家好&#xff0c;我叫储惠龙&#xff08;实名上网&#xff09;&#xff0c;你可以叫我小龙人&#xff0c;00 后一枚。目前从事后端开发工作。 今天给大家带来一个简单的为 NebulaGraph 提供 GraphQL 查询支持的 DEMO&#xff0c;为什么是简单的…

职业教育机构转线上时,选择平台要注意哪些方面?

职业教育是提升技能和知识的重要途径&#xff0c;有效的职业教育能够帮助培养和发展人才&#xff0c;相比较线下面授课程相比&#xff0c;在线直播的教学&#xff0c;可以节省较大成本&#xff0c;那么在选型直播平台时&#xff0c;要注意哪些方面呢&#xff1f; 1.需要实现高清…

记录一次使用__dirname和./引出的bug

JS项目中 保存本地生成的图片时使用的路径:__dirname“/waitToFinishTask.png"。 但是在获取这张图片的时候我使用的是“./waitToFinishTask.png”。 从而抛出异常&#xff1a;Error: ENOENT, No such file or directory ./waitToFinishTask.png 找了好久都不知道为什么会…

【无标题】windows下使用cmake编译c++

好久没有更新博客了 最近在做c相关的&#xff0c;编译起来确实很痛苦。 所以心血来潮&#xff0c;继续更新一下 主要还是一些跨平台的库&#xff0c;比如zlib、libpng、opencv、ffmpeg 编译工具使用mingw作为主要编译环境支持&#xff0c;使用msys进行编译。 一、下载mingw…

利用etcd实现分布式锁

python etcd3模块的lock使用 观察lock的加解锁影响 在python中已经自带了分布式锁的实现方式&#xff0c;下面我们尝试一下加锁与解锁的流程 在运行该demo同时也对lock对应的key进行watch&#xff0c;观察其变化&#xff0c;注意python-etcd3在实现分布式锁的时候&#xff0…

前端终止请求的三种方式(ajax、axios)

一、原生ajax终止请求 1、abort() ​ XMLHttpRequest.abort() 方法用于终止 XMLHttpRequest 对象的请求&#xff0c;该方法没有参数&#xff0c;也没有返回值。当调用该方法时&#xff0c;如果对应 XMLHttpRequest 对象的请求已经被发送并且正在处理中&#xff0c;则会中止该…

一个专科生的 Python 转行之路,虽然很难,但如今月薪1w,一切值得

一个专科生的 Python 转行之路&#xff0c;虽然很难&#xff0c;但如今月薪1w&#xff0c;一切值得 相信每个转 IT 的人, 大部分是兴趣驱动。然而我并不是, 只能说是不反感。一开始接触编程, 是一位同事&#xff0c;他会 java &#xff0c;也会一点前端。 印象最深刻的一次&…

前端如何处理「并发」问题?

&#x1f431; 个人主页&#xff1a;不叫猫先生&#xff0c;公众号&#xff1a;前端舵手 &#x1f64b;‍♂️ 作者简介&#xff1a;2022年度博客之星前端领域TOP 2&#xff0c;前端领域优质作者、阿里云专家博主&#xff0c;专注于前端各领域技术&#xff0c;共同学习共同进步…

Avalon 学习系列(四)—— 循环遍历

Avalon2 的 ms-for 绑定集齐了 ms-repeat, ms-each, ms-with 的所有功能&#xff0c; 更加好用&#xff0c; 性能也提升了很多。 Avalon 不需要 vue 或 react 那样使用 key 属性来提高性能&#xff0c;内部已经帮你搞定了。 循环数组 ms-for 循环数组示例&#xff1a; <…

运维圣经:勒索病毒应急响应指南

目录 勒索病毒简介 常见勒索病毒种类 WannaCry Globelmposter Crysis/ Dharma 攻击特点 应急响应方法指南 一. 隔离被感染的服务器/主机 二. 排查业务系统 三. 确定勒索病毒种类&#xff0c; 进行溯源分析 四. 恢复数据和业务 五. 清理加固 病毒清理及加固 感染文…

零基础也能懂的python办公自动化教程,从此上班摸鱼轻轻松松

前言 如今Python在自动化办公领域的表现越来越亮眼&#xff0c;受到了很多非IT的职场人士的推崇&#xff0c;也引得更多的人去了解、学习Python。但是很多初学者都会面临这么一个困惑&#xff1a;想把Python应用在工作中&#xff0c;却不知从何下手&#xff01;&#xff08;资…

【音视频处理】音频编码AAC详解,低码率提高音质?

大家好&#xff0c;欢迎来到停止重构的频道。 本期我们介绍音频编码格式AAC。 AAC是音频最常用的编码格式之一&#xff0c;几乎所有的播放器都支持这个编码格式。 其他音频编码格式都是类似的&#xff0c;只是某些细节存在差别&#xff0c;如压缩算法、某些音频参数存在限制…

6个ChatGPT4的最佳用途

文章目录 ChatGPT 4’s Current Limitations ChatGPT 4 的当前限制1. Crafting Complex Prompts 制作复杂的提示2. Logic Problems 逻辑问题3. Verifying GPT 3.5 Text 验证 GPT 3.5 文本4. Complex Coding 复杂编码5.Nuanced Text Transformation 细微的文本转换6. Complex Kn…