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 <opencv2/imgproc/types_c.h>
#include <opencv2/calib3d/calib3d_c.h>
在CameraCalibration.h中添加
#include <opencv2/imgproc/types_c.h>
#include <opencv2/imgproc/imgproc_c.h>
报错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 <opencv2/imgproc/types_c.h>

报错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

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

  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值