ubuntu安装opencv及vinsmono

1.安装opencv

安装参考: https://www.jianshu.com/p/59608e83becb.
使用3.4.10会减少vins-fusion的opencv环境问题,使用扩展模块中的xfeatures2d时,由于sift,surf等有专利,需要在cmake-gui中设置OPENCV_ENABLE_NONFREE,具体步骤参考https://blog.csdn.net/jindunwan7388/article/details/80397700.

2.部分版本问题报错解决

(这些错误可以通过IDE跳转至定义位置解决)
1.error: ‘CV_GRAY2RGB’ was not declared in this scope

#include<opencv2/imgproc/types_c.h>

2.error:‘CV_ADAPTIVE_THRESH_MEAN_C’ was not declared in this scope

#include <opencv2/calib3d/calib3d_c.h>

3.error: ‘CV_AA’ was not declared in this scope

#include “opencv2/imgproc/imgproc_c.h”

4.error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope

#include"opencv2/imgcodecs/legacy/constants_c.h"

在ubuntu20.04下编译使用vinsmono,需要注意ceres安装1.14版本,同时做如下修改

https://github.com/HKUST-Aerial-Robotics/VINS-Mono/pull/385/files?w=1

3.GDB调试

基于gdb启动ROS程序“rosrun --prefix ‘gdb -ex run --args’ package node” package表示包,node表示需要启动的节点。程序运行后当出现段错误时,对应的vins_node运行指令为(xx需要替换为自己的目录):

rosrun --prefix ‘gdb -ex run --args’ vins vins_node /home/xx/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_config.yaml

4.VIS_Fusion运行

使用opencv4.0以上出现段错误,gdb调试后发现问题在读取yaml配置文件处,重装opencv到3.4.10,错误消失正常运行。

5.ubuntu使用vscode+cmake

基础过程参考:
链接: https://code.visualstudio.com/docs/cpp/cmake-linux.
需要设置命令行参数参考:
链接: https://github.com/microsoft/vscode-cmake-tools/blob/develop/docs/debug-launch.md#debug-using-a-launchjson-file.
注意如果vscode的gdb调试报错找不到可执行文件路径,需要把cmake模式改为debug后重新生成可执行文件,不能直接使用release.

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值