在运行ros环境下的orb-slam3时出现核心已转储问题,我的ros是用鱼香ros一键安装的,自带的cv-bridge对应的是opencv4.2.0,而之前配环境时是opencv3.4.6,怀疑是这种问题。
一、卸载原有的opencv
cd build
sudo make uninstall
cd ..
sudo rm -r build
sudo rm -r /usr/local/include/opencv2 /usr/local/include/opencv /usr/include/opencv /usr/include/opencv2 /usr/local/share/opencv /usr/local/share/OpenCV /usr/share/opencv /usr/share/OpenCV /usr/local/bin/opencv* /usr/local/lib/libopencv*
二、安装opencv4.2.0
安装时参考opencv的官方文档(OpenCV: Installation in Linux)
2.1 从github中下载opencv4.2.0(GitHub - opencv/opencv at 4.2.0),建议使用download zip的方式,而不是git clone ,git clone容易下在成最新的opencv版本
2.2 解压后
cd ~/opencv
mkdir build
cd build
2.3 安装配置环境
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
2.4 用 CMake 从 Source 构建 OpenCV
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make -j8
sudo make install
2.5 配置环境