1 cmake install opencv2 opencv4.2 from source
add
#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
#define AVFMT_RAWPICTURE 0x0020
to yourPath/opencv-2.4.13.5/modules/highgui/src/cap_ffmpeg_impl.hpp
2 cmake install ceres-solver-1.14.0 from source
system dep.
sudo apt-get install libglew-dev libopencv-dev libyaml-cpp-dev
Ceres dep.
sudo apt-get install libblas-dev liblapack-dev libsuitesparse-dev
wget ceres-solver.org/ceres-solver-1.14.0.tar.gz
sudo apt-get install -y cmake libgoogle-glog-dev libatlas-base-dev libsuitesparse-dev
cd ceres-solver-1.14.0
mkdir build
cd build
~~cmake ..~~
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make -j4
sudo make install
if you encount the follow errors:
internal/ceres/gtest/gtest.h:10445:35:
error: variable or field ‘it’ declared
void 10445 | for (typename C::const_iterator it = container.begin();
try:
eigen版本回退太麻烦了,或许可以试试将cmake … 改为cmake … -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF,避免一些不必要的编译
3 build vins-fusion
Clone the repository and catkin_make:
1 add headers to KITTIGPSTest.cpp, KITTIOdomTest.cpp
// #include <opencv2/imgcodecs/imgcodecs_c.h> //has been removed
#include "opencv2/imgcodecs/legacy/constants_c.h"
2 alter opencv2 to opencv4.2:
所有由于opencv版本引发的错误均集中在这里:
2.1 error: ‘CV_GRAY2BGR’ was not declared in this scope
error: ‘CV_BGR2GRAY’ was not declared in this scope
2.2 error: ‘CV_CALIB_CB_ADAPTIVE_THRESH’ was not declared in this scope
2.3 error: ‘CV_ADAPTIVE_THRESH_MEAN_C’ was not declared in this scope
2.4 error: ‘CV_THRESH_BINARY’ was not declared in this scope
2.5 error: ‘CV_AA’ was not declared in this scope; did you mean ‘CV_MSA’?
2.6 error: ‘CV_SHAPE_CROSS’ was not declared in this scope
2.7 error: ‘CV_RETR_CCOMP’ was not declared in this scope
error: ‘CV_CHAIN_APPROX_SIMPLE’ was not declared in this scope
2.8 error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
2.9 error: ‘CV_FONT_HERSHEY_SIMPLEX’ was not declared in this scope
FIX:
# 2.1
# /home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/chessboard/Chessboard.cc
CV_GRAY2BGR ⇒ cv::COLOR_GRAY2BGR
CV_BGR2GRAY ⇒ cv::COLOR_BGR2GRAY 两处
# /home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/calib/CameraCalibration.cc
CV_GRAY2BGR ⇒ cv::COLOR_GRAY2BGR
# /home/robot/catkin_ws/src/VINS-Fusion/vins_estimator/src/featureTracker/feature_tracker.cpp
CV_GRAY2RGB ⇒ cv::COLOR_GRAY2RGB
/home/robot/catkin_ws/src/VINS-Fusion/loop_fusion/src/ThirdParty/DVision/BRIEF.cpp
CV_RGB2GRAY ⇒ cv::COLOR_RGB2GRAY
# 2.2
# 还是/home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/chessboard/Chessboard.cc
添加 #include <opencv2/calib3d/calib3d_c.h>
# 2.3
# 还是/home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/chessboard/Chessboard.cc
添加#include<opencv2/imgproc/types_c.h>
# 2.4
# 还是/home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/chessboard/Chessboard.cc
CV_THRESH_BINARY ⇒ cv::THRESH_BINARY 四处
# 2.5
# /home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/chessboard/Chessboard.cc
# /home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/calib/CameraCalibration.cc
# /home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/intrinsic_calib.cc
添加#include “opencv2/imgproc/imgproc_c.h”
#2.6
# /home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/chessboard/Chessboard.cc
CV_SHAPE_CROSS ⇒ cv::MORPH_CROSS
CV_SHAPE_RECT ⇒ cv::MORPH_RECT
# 2.7
# /home/robot/catkin_ws/src/VINS-Fusion/camera_models/src/chessboard/Chessboard.cc
CV_RETR_CCOMP ⇒ cv::RETR_CCOMP 三处
CV_CHAIN_APPROX_SIMPLE ⇒ cv::CHAIN_APPROX_SIMPLE 三处
# 2.8
# /home/robot/catkin_ws/src/VINS-Fusion/vins_estimator/src/KITTIGPSTest.cpp
# /home/robot/catkin_ws/src/VINS-Fusion/vins_estimator/src/KITTIOdomTest.cpp
CV_LOAD_IMAGE_GRAYSCALE ⇒ cv::IMREAD_GRAYSCALE 各两处
# 2.9
# /home/robot/catkin_ws/src/VINS-Fusion/loop_fusion/src/keyframe.cpp
# /home/robot/catkin_ws/src/VINS-Fusion/loop_fusion/src/pose_graph.cpp
CV_FONT_HERSHEY_SIMPLEX ⇒ cv::FONT_HERSHEY_SIMPLEX 一个两处,一个五处
原文链接:https://blog.csdn.net/qq_41746268/article/details/133816982
cd ~/catkin_ws/src
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Fusion.git
cd ../
catkin_make
source ~/catkin_ws/devel/setup.bash
4 Evolution using evo
4.1
4.2
SLAM中evo评估工具(用自己的数据集评估vinsFusion)
Vins-Fusion运行kitti,euroc和tum数据集并使用evo评估
5 install ros-noetic
wget http://fishros.com/install -O fishros && . fishros