原 Jeston TX2-ORBSLAM2_with_pointcloud_map
github上的工程项目:ORBSLAM2_with_pointcloud_map,用于实现orbslam2的稠密建图
环境搭建步骤如下:
1.编译Opencv
参照之前博客安装
2.编译Pangolin
github链接:Pangolin
Required Dependencies
C++11
OpenGL (Desktop / ES / ES2)
-
Glew
- (win) built automatically (assuming git is on your path)
- (deb)
sudo apt-get install libglew-dev
- (mac)
sudo port install glew
-
CMake (for build environment)
- (win) http://www.cmake.org/cmake/resources/software.html
- (deb)
sudo apt-get install cmake
- (mac)
sudo port install cmake
Building
Pangolin uses the CMake portable pre-build tool. To checkout and build pangolin in the directory 'build', execute the following at a shell (or the equivelent using a GUI):
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake ..
cmake --build .
If you would like to build the documentation and you have Doxygen installed, you can execute:
cmake --build . --target doc
3.编译PCL
因为作者采用pclviewer观察点云,因而需要安装pcl
sudo apt-get install libpcl-1.7
4.编译g2o
作者使用的是修改后的g2o,相关安装流程可以参考官方github链接:g2o
(1)依赖项的安装
- cmake http://www.cmake.org/
- Eigen3 http://eigen.tuxfamily.org
其中cmake可以直接使用该语句进行安装
sudo apt-get install cmake
该github工程中的cmakelist.txt中注明了Eigen3的版本为3.1,实测只有3.1~3.2之内的版本有效。
- mkdir build
- cd build && cmake ..
- make install
(2)编译g2o
mkdir build
cd build
cmake ../
make
因为作者github工程的cmakelist.txt中并未手动设定g2o的文件路径,采取自动查找的方式,因而需要
make install
5.拷贝ORBvoc.txt.tar.gz并提取
作者并没有在工程中放入ORBvoc.txt.tar.gz字典,因而从ORB_SLAM2此处下载字典,拷贝至Vocabulary并提取。
6.编译DBoW2
mkdir build
cd build
cmake ../
make
7.编译ORB_SLAM2_modified
(1)修改cmakelist.txt
cmake_minimum_required(VERSION 2.8)
project(ORB_SLAM2)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF()
MESSAGE("Build type: " ${CMAKE_BUILD_TYPE})
#set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
# Check C++11 or C++0x support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_definitions(-DCOMPILEDWITHC11)
message(STATUS "Using flag -std=c++11.")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
add_definitions(-DCOMPILEDWITHC0X)
message(STATUS "Using flag -std=c++0x.")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
find_package(OpenCV 3.3 REQUIRED)
find_package(Eigen3 3.1.0 REQUIRED)
find_package(Pangolin REQUIRED)
find_package( G2O REQUIRED )
find_package( PCL 1.7 REQUIRED )
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
${EIGEN3_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)
add_definitions( ${PCL_DEFINITIONS} )
link_directories( ${PCL_LIBRARY_DIRS} )
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
add_library(${PROJECT_NAME} SHARED
src/System.cc
src/Tracking.cc
src/LocalMapping.cc
src/LoopClosing.cc
src/ORBextractor.cc
src/ORBmatcher.cc
src/FrameDrawer.cc
src/Converter.cc
src/MapPoint.cc
src/KeyFrame.cc
src/Map.cc
src/MapDrawer.cc
src/Optimizer.cc
src/PnPsolver.cc
src/Frame.cc
src/KeyFrameDatabase.cc
src/Sim3Solver.cc
src/Initializer.cc
src/Viewer.cc
src/pointcloudmapping.cc
)
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so
g2o_core g2o_types_slam3d g2o_solver_csparse g2o_stuff g2o_csparse_extension g2o_types_sim3 g2o_types_sba
${PCL_LIBRARIES}
)
# Build examples
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/Examples/RGB-D)
add_executable(rgbd_tum
Examples/RGB-D/rgbd_tum.cc)
target_link_libraries(rgbd_tum ${PROJECT_NAME})
add_executable(rgbd_my
Examples/RGB-D/rgbd_my.cc)
target_link_libraries(rgbd_my ${PROJECT_NAME})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/Examples/Stereo)
add_executable(stereo_kitti
Examples/Stereo/stereo_kitti.cc)
target_link_libraries(stereo_kitti ${PROJECT_NAME})
add_executable(stereo_euroc
Examples/Stereo/stereo_euroc.cc)
target_link_libraries(stereo_euroc ${PROJECT_NAME})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/Examples/Monocular)
add_executable(mono_tum
Examples/Monocular/mono_tum.cc)
target_link_libraries(mono_tum ${PROJECT_NAME})
add_executable(mono_kitti
Examples/Monocular/mono_kitti.cc)
target_link_libraries(mono_kitti ${PROJECT_NAME})
add_executable(mono_euroc
Examples/Monocular/mono_euroc.cc)
target_link_libraries(mono_euroc ${PROJECT_NAME})
(2)编译
mkdir build
cd build
cmake ../
make
8.下载测试数据集并测试结果
下载地址参见:ORB_SLAM2的readme文档
上一篇: 【架构】Restful API
下一篇: PCL点云特征描述与提取
推荐阅读
-
原 Jeston TX2-ORBSLAM2_with_pointcloud_map
-
DRDS到MaxCompute(原ODPS)数据归档性能优化测试
-
删除顺序表中重复元素,并按照原序输出
-
JAVA反编译[原] 博客分类: 杂货铺 JavaEclipseVC++Swing
-
JAVA反编译[原] 博客分类: 杂货铺 JavaEclipseVC++Swing
-
(c语言)输入一个数,将该数按原规律插入到有序数组中
-
jquery easy ui tree 空节点(无子节点)初始为closed状态展开是会重复加载原url的内容 博客分类: web前端 easyui
-
糖果Y8 Max手机刷机原厂线刷包msm8917附教程 博客分类: 三星
-
dwz框架新建更新后对原表格刷新 博客分类: Web dwztab刷新
-
java原电话本管理系统+改方法用系统给的ArrayList类的方法实现。