Ubuntu20.04 (ROS noetic) 运行 Vins-Fusion

参考博客:Ubuntu20.04 运行 Vins-Fusion,问题没有完全解决,所以自己写了一篇


Vins-Fusion 开源地址:https://github.com/HKUST-Aerial-Robotics/VINS-Fusion

由于仅支持ROS kinetic 和 melodic,所以在Ubuntu20.04对应的ROS noetic 编译会报错,需要稍加修改。


首先添加OpenCV4支持:
在camera_model包中的头文件Chessboard.h中添加
#include 
#include 
在CameraCalibration.h中添加
#include 
#include 
报错1:
CMake Error at /usr/local/lib/cmake/Ceres/CeresConfig.cmake:85 (message):
  Failed to find Ceres - Found Eigen dependency, but the version of Eigen
  found (3.3.90) does not exactly match the version of Eigen Ceres was
  compiled with (3.3.7).  This can cause subtle bugs by triggering violations
  of the One Definition Rule.  See the Wikipedia article
  http://en.wikipedia.org/wiki/One_Definition_Rule for more details
Call Stack (most recent call first):
  /usr/local/lib/cmake/Ceres/CeresConfig.cmake:200 (ceres_report_not_found)
  VINS-Fusion/camera_models/CMakeLists.txt:19 (find_package)

解决方法:卸载原来的Eigen3.3.9,安装Eigen3.3.7 Eigen3.3.7下载链接

解压后,运行

cd eigen-3.3.7
mkdir build && cd build
cmake ..
sudo make install
报错2:
CMake Error at VINS-Fusion/camera_models/CMakeLists.txt:19 (find_package):
  Found package configuration file:

    /usr/local/lib/cmake/Ceres/CeresConfig.cmake

  but it set Ceres_FOUND to FALSE so package "Ceres" is considered to be NOT
  FOUND.

解决方法:先别急,这个我没有改,但其他的改完这个就不报错了(

报错3:
error: ‘CV_RGB2GRAY’ was not declared in this scope
   53 |       cv::cvtColor(image, aux, CV_RGB2GRAY);
      |                                ^~~~~~~~~~~

解决方法:在报错的头文件里添加 #include

报错4:
 error: ‘CV_FONT_HERSHEY_SIMPLEX’ was not declared in this scope
  427 |         putText(compressed_image, "feature_num:" + to_string(feature_num), cv::Point2f(10, 10), CV_FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(255));
      |             

解决方法:这类报错主要是由OpenCV4和OpenCV3的语法差异造成的,查询对应语法即可。将报错文件中的 CV_FONT_HERSHEY_SIMPLEX 参数改为cv::FONT_HERSHEY_SIMPLEX

报错5:
error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
   95 |    imLeft = cv::imread(leftImagePath, CV_LOAD_IMAGE_GRAYSCALE );
      |                

解决方法:将报错文件中的CV_LOAD_IMAGE_GRAYSCALE全部改为 cv::IMREAD_GRAYSCALE

所有的都执行完之后,就成功编译啦

Ubuntu20.04 (ROS noetic) 运行 Vins-Fusion_第1张图片

你可能感兴趣的:(ubuntu,opencv)