Conférence 14 sur Visual SLAM—ch7 Practice (Visual Odometry 1)

1. Préparatifs avant l'utilisation pratique

  1. Entrez le dossier ch7 dans le terminal et exécutez les commandes suivantes pour compiler.
mkdir build
cd build
cmake ..
//注意,j8还是其他主要看自己的电脑情况
make -j8
  1. Exécutez-le dans le fichier de construction.
    Remarque : Il peut y avoir des avertissements pendant le processus de création, mais cela n'affectera pas la fin.

2. Processus de pratique

2.1 Extraction et mise en correspondance de caractéristiques

1. Fonctionnalité ORB d'OpenCV
Exécutez l'instruction dans la construction : ./orb_cv /home/fighter/slam/slambook2/ch7/1.png /home/fighter/slam/slambook2/ch7/2.png ( Remarque : recommandé d'utiliser directement le chemin absolu )
Il convient de noter que: les paramètres d'image ici sont transmis au terminal, si vous ne voulez pas passer, vous pouvez également modifier le code et l'obtenir directement via le code.
Résultat de l'exécution :
Extraction de caractéristiques ORB
correspondance des fonctionnalités, les meilleures et toutes
lorsque la fenêtre est affichée, le terminal affiche les informations suivantes :

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

2. Fonctionnalités ORB manuscrites
Exécutez l'instruction dans la construction : ./orb_self ( Remarque : si l'opération est erronée et que l'image est introuvable, n'oubliez pas de modifier le chemin de l'image dans le fichier orb_self.cpp )
Résultat en cours d'exécution :
balles de match
en même temps , le terminal affiche certaines caractéristiques Informations correspondantes :

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

On peut voir que l'extraction des caractéristiques n'a pris que 4,7 millisecondes et que la correspondance n'a pris que 1,3 millisecondes.

2.2 Géométrie épipolaire

Exécutez la déclaration dans la construction : ./pose_estimation_2d2d /home/fighter/slam/slambook2/ch7/1.png /home/fighter/slam/slambook2/ch7/2.png
Résultat :

-- 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 Triangulation

Exécutez l'instruction dans build : ./triangulation /home/fighter/slam/slambook2/ch7/1.png /home/fighter/slam/slambook2/ch7/2.png

Résultat de l'exécution :
deux tableaux comparatifs
lors de l'exécution, le terminal affichera :

-- 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 Résolution de PnP

Exécutez la déclaration dans la construction : ./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 ( remarque : les paramètres ici sont quatre, deux images, deux images de profondeur correspondantes )
résultats en cours :

-- 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 Résoudre ICP

Exécutez la déclaration dans la construction : ./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
résultat courant :

  • En prenant l'ajustement du groupe d'appels comme limite, le résultat de l'opération au-dessus de l'ajustement du groupe d'appels est résolu par la méthode SVD, et la partie suivante de l'ajustement du groupe d'appels est une méthode d'optimisation non linéaire.
-- 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. Problèmes rencontrés

3.1 Problèmes rencontrés lors des travaux de préparation

  1. Problème : L'erreur suivante s'est produite lors du processus 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

Solution :
Ce type de problème se produit principalement parce que la version d'opencv dans le code est différente de la version actuellement installée par vous-même, changez simplement la version d'opencv dans le fichier CMakeLists.txt.

//更改前:
find_package(OpenCV 3 REQUIRED)
//更改后:
find_package(OpenCV REQUIRED)
  1. Problème : J'obtiens l'erreur suivante lorsque 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

Il est illustré dans la figure ci-dessous :
problèmes de fabrication
Cause du problème : La raison principale de ce type de problème est que CV_LOAD_IMAGE_COLOR est une ancienne constante utilisée dans la version OpenCV 2.x.
Solution : Il existe deux principales méthodes de modification, l'une consiste à ajouter des fichiers d'en-tête et l'autre à modifier le code.
Méthode 1 : Ajoutez un fichier d'en-tête : #include <opencv2/imgcodecs/imgcodecs_c.h> Si cela ne fonctionne toujours pas, essayez ceci ( #include "opencv2/imgcodecs/legacy/constants_c.h" )
Méthode 2 : Dans OpenCV 3 .x et supérieur Dans les versions supérieures, la constante IMREAD_COLOR doit être utilisée à la place.

Remarque 1 : Pour plus d'informations sur les changements d'erreur opencv, veuillez consulter l'article suivant : https://blog.csdn.net/qq_44164791/article/details/131210608?spm=1001.2014.3001.5501
Remarque 2 : Vous devez modifier tous les fichiers qui signalent des erreurs ! ! !

Je suppose que tu aimes

Origine blog.csdn.net/qq_44164791/article/details/131209808
conseillé
Classement