MultiCol-SLAM
ThirdParty Dependencies:
修改编译脚本:
echo "Configuring and building Thirdparty/opencv ..." cd ThirdParty/opencv-3.1.0 mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake make -j4 make install cd ../../../ echo "Configuring and building Thirdparty/DBoW2 ..." cd ThirdParty/DBoW2 mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake make -j cd ../../ echo "Configuring and building Thirdparty/g2o ..." EIGEN3_INCLUDE_DIR=$(pwd)/Eigen export EIGEN3_INCLUDE_DIR cd g2o mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake make echo "Configuring and building Thirdparty/opengv ..." cd ../../OpenGV mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake make -j2 echo "Configuring and building MultiCol-SLAM ..." cd ../../../ echo $(pwd) mkdir build cd build #cmake .. -DCMAKE_BUILD_TYPE=Debug cmake .. -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake make -j2
开始编译首先source
source /opt/android-ndk-r21b-linux-x86_64/environment-setup-aarch64-android-linux
Pangolin:在android 不使用Pangolin不显示,所以用不编译
OpenCV 3:NDK中没有opencv,需要把opencv 源码放入第三方依赖,编译问题:
MultiCol-SLAM/ThirdParty/opencv-3.1.0/3rdparty/libpng/pngrutil.c:3943: undefined reference to `png_init_filter_functions_neon'
找不到png_init_filter_functions_neon实现。android NDK不支持PNG_ARM_NEON加速
修改代码如下:pngpriv.h line:128
# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && 改成=====================> # if defined(PNG_ARM_NEON) && (defined(__ARM_NEON__) || defined(__ARM_NEON)) &&
DBoW2 :
CMake Error at CMakeLists.txt:33 (find_package):
find opencv package 失败,NDK中没有install opencv 所以失败,CMakeLists需要手动添加include和lib路径:
clang++: error: the clang compiler does not support '-march=native'
不支持编译标签 -march=native,CMakeLists删除-march=native
MultiCol-SLAM/ThirdParty/DBoW2/DBoW2/FORB.cpp:19:10: fatal error: 'stdint-gcc.h' file not found
找不到stdint-gcc.h头文件,改成stdint.h
../../opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a(system.cpp.o): In function `cv::error(cv::Exception const&)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/system.cpp:643: undefined reference to `__android_log_print' ../../opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a(persistence.cpp.o): In function `icvCloseFile(CvFileStorage*)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/persistence.cpp:308: undefined reference to `gzclose' ../../opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a(persistence.cpp.o): In function `icvRewind(CvFileStorage*)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/persistence.cpp:323: undefined reference to `gzrewind' ../../opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a(persistence.cpp.o): In function `icvCloseFile(CvFileStorage*)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/persistence.cpp:308: undefined reference to `gzclose' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/persistence.cpp:308: undefined reference to `gzclose' ../../opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a(persistence.cpp.o): In function `cvOpenFileStorage': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/persistence.cpp:2714: undefined reference to `gzopen' ../../opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a(persistence.cpp.o): In function `icvPuts(CvFileStorage*, char const*)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/persistence.cpp:253: undefined reference to `gzputs' ../../opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a(persistence.cpp.o): In function `icvGets(CvFileStorage*, char*, int)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/persistence.cpp:283: undefined reference to `gzgets' ../../opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a(persistence.cpp.o): In function `icvEof(CvFileStorage*)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/persistence.cpp:297: undefined reference to `gzeof' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/opencv-3.1.0/modules/core/src/persistence.cpp:297: undefined reference to `gzeof'
链接错误:opencv 使用了libzlib和log 在CMakeLists加入这两个链接
修改CMakeLists.txt输入下:
cmake_minimum_required(VERSION 2.8)
project(DBoW2)
IF(WIN32)
SET (DBoW2_LIB_TYPE STATIC)
ELSE()
SET (DBoW2_LIB_TYPE SHARED)
ENDIF(WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3")
set(HDRS_DBOW2
DBoW2/BowVector.h
DBoW2/FORB.h
DBoW2/FClass.h
DBoW2/FeatureVector.h
DBoW2/ScoringObject.h
DBoW2/TemplatedVocabulary.h)
set(SRCS_DBOW2
DBoW2/BowVector.cpp
DBoW2/FORB.cpp
DBoW2/FeatureVector.cpp
DBoW2/ScoringObject.cpp)
set(HDRS_DUTILS
DUtils/Random.h
DUtils/Timestamp.h)
set(SRCS_DUTILS
DUtils/Random.cpp
DUtils/Timestamp.cpp)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../opencv-3.1.0/build/install/sdk/native/jni)
FIND_PACKAGE(OpenCV QUIET )
IF(NOT OpenCV_FOUND)
SET(OpenCV_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/../opencv-3.1.0/build/install/sdk/native/jni/include)
SET(OpenCV_LIBS ${PROJECT_SOURCE_DIR}/../opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a)
ENDIF()
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
include_directories(${OpenCV_INCLUDE_DIRS})
add_library(DBoW2 ${DBoW2_LIB_TYPE} ${SRCS_DBOW2} ${SRCS_DUTILS})
target_link_libraries(DBoW2 -lz -llog ${OpenCV_LIBS})
g2o:
clang++: error: the clang compiler does not support '-march=native'
同上修改CMakeLists
MultiCol-SLAM/ThirdParty/g2o/g2o/types/../core/hyper_graph.h:41:10: fatal error: 'tr1/unordered_map' file not found
不支持android的NDK 中没有tr1目录直接使用unordered_map,代码中有多个tr1的目录都需要修改
Eigen 3:只是头文件引用
OpenGV:
clang++: error: the clang compiler does not support '-march=native'
同上修改CMakeLists
MultiCol-SLAM:
CMake Error at CMakeLists.txt:43 (find_package):
find opencv package 失败,同上。
CMake Error in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as
增加cmake版本信息
clang++: error: the clang compiler does not support '-march=native'
同上
MultiCol-SLAM/include/cam_model_omni.h:38:10: fatal error: 'opencv2/opencv.hpp' file not found
CMakeLists.txt 加opencv 头文件目录
MultiCol-SLAM/include/cMapPublisher.h:36:10: fatal error: 'pangolin/pangolin.h' file not found
因为不需要描画显示,删除使用pangolin 和 cViewer
In file included from /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cOptimizerLoopStuff.cpp:27:
In file included from /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/include/cOptimizer.h:30:
In file included from /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/include/cMap.h:31:
In file included from /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/include/cMapPoint.h:31:
In file included from /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/include/cMultiKeyFrame.h:38:
In file included from /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/ThirdParty/DBoW2/DBoW2/BowVector.h:14:
/opt/android-ndk-r21b-linux-x86_64/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/map:910:5: error: static_assert failed due to requirement 'is_same<std::__ndk1::pair<const MultiColSLAM::cMultiKeyFrame *, g2o::Sim3>, std::__ndk1::pair<MultiColSLAM::cMultiKeyFrame *const, g2o::Sim3> >::value' "Allocator::value_type must be same type as value_type"
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cOptimizerLoopStuff.cpp:315:18: note: in instantiation of template class 'std::__ndk1::map<MultiColSLAM::cMultiKeyFrame *, g2o::Sim3, std::__ndk1::less<MultiColSLAM::cMultiKeyFrame *>, Eigen::aligned_allocator<std::__ndk1::pair<const MultiColSLAM::cMultiKeyFrame *, g2o::Sim3> > >' requested here
cLoopClosing::KeyFrameAndPose::const_iterator it = CorrectedSim3.find(pMKF)
修改const位置
typedef std::map<cMultiKeyFrame*, g2o::Sim3, std::less<cMultiKeyFrame*>, Eigen::aligned_allocator<std::pair<const cMultiKeyFrame*, g2o::Sim3> > > KeyFrameAndPose; 修改成====================================> typedef std::map<cMultiKeyFrame*, g2o::Sim3, std::less<cMultiKeyFrame*>, Eigen::aligned_allocator<std::pair< cMultiKeyFrame* const, g2o::Sim3> > > KeyFrameAndPose;
CMakeFiles/MultiCol-SLAM.dir/src/cam_model_omni.cpp.o: In function `MultiColSLAM::CreateMirrorMask(MultiColSLAM::cCamModelGeneral_, int, std::__ndk1::vector<cv::Mat, std::__ndk1::allocator<cv::Mat> >&)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cam_model_omni.cpp:191: undefined reference to `cv::buildPyramid(cv::_InputArray const&, cv::_OutputArray const&, int, int)' CMakeFiles/MultiCol-SLAM.dir/src/cMultiFramePublisher.cpp.o: In function `MultiColSLAM::cMultiFramePublisher::DrawMultiFrame(std::__ndk1::vector<cv::Mat, std::__ndk1::allocator<cv::Mat> >&)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cMultiFramePublisher.cpp:120: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cMultiFramePublisher.cpp:131: undefined reference to `cv::line(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cMultiFramePublisher.cpp:154: undefined reference to `cv::rectangle(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cMultiFramePublisher.cpp:155: undefined reference to `cv::circle(cv::_InputOutputArray const&, cv::Point_<int>, int, cv::Scalar_<double> const&, int, int, int)' CMakeFiles/MultiCol-SLAM.dir/src/cMultiFramePublisher.cpp.o: In function `MultiColSLAM::cMultiFramePublisher::DrawTextInfo(cv::Mat&, int, cv::Mat&)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cMultiFramePublisher.cpp:207: undefined reference to `cv::getTextSize(cv::String const&, int, double, int, int*)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cMultiFramePublisher.cpp:212: undefined reference to `cv::putText(cv::_InputOutputArray const&, cv::String const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)' CMakeFiles/MultiCol-SLAM.dir/src/cSim3Solver.cpp.o: In function `MultiColSLAM::cSim3Solver::computeT(cv::Matx<double, 3, 3>&, cv::Matx<double, 3, 3>&)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cSim3Solver.cpp:339: undefined reference to `cv::Rodrigues(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/cSim3Solver.cpp:349: undefined reference to `cv::pow(cv::_InputArray const&, double, cv::_OutputArray const&)' CMakeFiles/MultiCol-SLAM.dir/src/mdBRIEFextractorOct.cpp.o: In function `MultiColSLAM::mdBRIEFextractorOct::ComputeKeyPointsOctTree(std::__ndk1::vector<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >, std::__ndk1::allocator<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> > > >&)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:870: undefined reference to `cv::AgastFeatureDetector::create(int, bool, int)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:872: undefined reference to `cv::FastFeatureDetector::create(int, bool, int)' CMakeFiles/MultiCol-SLAM.dir/src/mdBRIEFextractorOct.cpp.o: In function `MultiColSLAM::IC_Angle(cv::Mat const&, cv::Point_<float>, std::__ndk1::vector<int, std::__ndk1::allocator<int> > const&)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:247: undefined reference to `cv::fastAtan2(float, float)' CMakeFiles/MultiCol-SLAM.dir/src/mdBRIEFextractorOct.cpp.o: In function `MultiColSLAM::mdBRIEFextractorOct::ComputeKeyPointsOld(std::__ndk1::vector<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >, std::__ndk1::allocator<std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> > > >&)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:1059: undefined reference to `cv::FAST(cv::_InputArray const&, std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int, bool)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:1065: undefined reference to `cv::FAST(cv::_InputArray const&, std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int, bool)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:1130: undefined reference to `cv::KeyPointsFilter::retainBest(std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:1148: undefined reference to `cv::KeyPointsFilter::retainBest(std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, int)' CMakeFiles/MultiCol-SLAM.dir/src/mdBRIEFextractorOct.cpp.o: In function `MultiColSLAM::mdBRIEFextractorOct::ComputePyramid(cv::Mat, cv::Mat)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:1179: undefined reference to `cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)' /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:1182: undefined reference to `cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)' CMakeFiles/MultiCol-SLAM.dir/src/mdBRIEFextractorOct.cpp.o: In function `MultiColSLAM::mdBRIEFextractorOct::operator()(cv::_InputArray const&, cv::_InputArray const&, std::__ndk1::vector<cv::KeyPoint, std::__ndk1::allocator<cv::KeyPoint> >&, MultiColSLAM::cCamModelGeneral_&, cv::_OutputArray const&, cv::_OutputArray const&)': /home/yangtze/SLAM/MultiColBase/MultiCol-SLAM/src/mdBRIEFextractorOct.cpp:1301: undefined reference to `cv::boxFilter(cv::_InputArray const&, cv::_OutputArray const&, int, cv::Size_<int>, cv::Point_<int>, bool, int)'
链接错误,大部分的opencv库都是用了,所以需要把所有opencv 和opencv的第三方库都加进来,由于链接是用顺序的,依赖库放在后面,如opencv_highgui依赖 opencv_imgproc 依赖opencv_core,被依赖库
opencv_core
放在最后。
CMakeLists.txt如下:
# This file is part of MultiCol-SLAM # # Copyright (C) 2015-2016 Steffen Urban <rurbste at googlemail.com> # For more information see <https://github.com/urbste/MultiCol-SLAM> # # MultiCol-SLAM is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # MultiCol-SLAM is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with MultiCol-SLAM . If not, see <http://www.gnu.org/licenses/>. cmake_minimum_required(VERSION 2.8) project (MultiCol-SLAM) IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Release) ENDIF() if (WIN32) SET (MCSSLAM_LIB_TYPE ) else() SET (MCSSLAM_LIB_TYPE SHARED) endif(WIN32) MESSAGE("Build type: " ${CMAKE_BUILD_TYPE}) IF(WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -openmp -W0 -MP") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -openmp -W0 -MP") ELSE() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp -O3 -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -O3 -std=c++11") MESSAGE("${CMAKE_CXX_FLAGS}") ENDIF() LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules) SET(OpenCV_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/jni/include) SET(OpenCV_LIBS ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_calib3d.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_features2d.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_flann.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_highgui.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_imgcodecs.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_imgproc.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_core.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_ml.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_objdetect.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_photo.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_shape.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_stitching.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_ts.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_photo.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_video.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_videoio.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/libs/arm64-v8a/libopencv_videostab.a) SET(OpenCV_LIBS_THIRD ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/3rdparty/libs/arm64-v8a/libIlmImf.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/3rdparty/libs/arm64-v8a/liblibjasper.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/3rdparty/libs/arm64-v8a/liblibjpeg.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/3rdparty/libs/arm64-v8a/liblibpng.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/3rdparty/libs/arm64-v8a/liblibtiff.a ${PROJECT_SOURCE_DIR}/ThirdParty/opencv-3.1.0/build/install/sdk/native/3rdparty/libs/arm64-v8a/liblibwebp.a) # ============================================================================== # Search OpenGV # ============================================================================== #FIND_PACKAGE(OpenGV QUIET HINTS ${OpenGV_DIR_HINTS}) #IF(NOT OpenGV_FOUND) SET(OpenGV_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/ThirdParty/OpenGV/include) SET(OpenGV_LIBRARIES opengv) MESSAGE("OpenGV include DIR ${OpenGV_INCLUDE_DIR}") INCLUDE_DIRECTORIES(${OpenGV_INCLUDE_DIR}) #ENDIF() # ============================================================================== # Search g2o includes # ============================================================================== #FIND_PACKAGE(g2o QUIET HINTS ${g2o_DIR_HINTS}) #IF(NOT g2o_FOUND) SET(g2o_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/ThirdParty/g2o) SET(g2o_LIBRARIES g2o) MESSAGE("g2o include DIR ${g2o_INCLUDE_DIR}") INCLUDE_DIRECTORIES(${g2o_INCLUDE_DIR}) #ENDIF() # ============================================================================== # Search Eigen, borrowed from openMVG # this makes it a lot smoother for Windows # ============================================================================== # - internal by default, (Eigen version 3.2.9) # - external if EIGEN_INCLUDE_DIR_HINTS is defined # ============================================================================== IF(NOT DEFINED EIGEN_INCLUDE_DIR_HINTS) SET(EIGEN_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/ThirdParty/Eigen) MESSAGE("Eigen include DIR ${EIGEN_INCLUDE_DIR}") #SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/ThirdParty/Eigen/cmake) #FIND_PACKAGE(Eigen3 REQUIRED) #MESSAGE("-- Eigen version ${EIGEN3_VERSION}: ${EIGEN3_INCLUDE_DIR}") #INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIR}) SET(MultiCol-SLAM_USE_INTERNAL_EIGEN ON) INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIR}) ENDIF() SET(MultiColHeaders include/cam_model_omni.h include/cam_system_omni.h include/cConverter.h include/cMultiFrame.h include/cMultiFramePublisher.h include/cMultiKeyFrame.h include/cConverter.h include/cMapPoint.h include/cMap.h include/cMapPublisher.h include/cLocalMapping.h include/cLoopClosing.h include/cOptimizer.h include/cORBVocabulary.h include/cORBmatcher.h include/cMultiFrame.h include/cMultiKeyFrameDatabase.h include/cSim3Solver.h include/cSystem.h include/cTracking.h include/cMultiInitializer.h #include/cViewer.h include/mdBRIEFextractorOct.h include/misc.h #include/MultiCol_cayley_jacobians.h include/g2o_MultiCol_vertices_edges.h include/g2o_MultiCol_sim3_expmap.h ) include_directories( ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/ThirdParty ${PROJECT_SOURCE_DIR}/ThirdParty/g2o ${OpenCV_INCLUDE_DIRS} ) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) add_library(${PROJECT_NAME} ${MCSSLAM_LIB_TYPE} src/cam_model_omni.cpp src/cam_system_omni.cpp src/cConverter.cpp src/cMultiFrame.cpp src/cMultiFramePublisher.cpp src/cMultiKeyFrame.cpp src/cConverter.cpp src/cMapPoint.cpp src/cMap.cpp src/cMapPublisher.cpp src/cOptimizer.cpp src/cOptimizerLoopStuff.cpp src/cMultiFrame.cpp src/cMultiKeyFrameDatabase.cpp src/cSim3Solver.cpp src/cSystem.cpp src/cMultiInitializer.cpp src/mdBRIEFextractorOct.cpp src/cTracking.cpp src/cLocalMapping.cpp src/cLoopClosing.cpp #src/cViewer.cpp src/cORBmatcher.cpp src/g2o_MultiCol_sim3_expmap.cpp src/g2o_MultiCol_vertices_edges.cpp src/misc.cpp ${MultiColHeaders} ) IF(WIN32) SET (G2OLIBS_DEBUG ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/bin/Debug/g2o.lib) SET (DBOW2LIBS_DEBUG ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/Debug/DBoW2.lib) SET (OPENGVLIBS_DEBUG ${PROJECT_SOURCE_DIR}/ThirdParty/OpenGV/build/lib/Debug/opengv.lib) SET (RANDOMGENLIBS_DEBUG ${PROJECT_SOURCE_DIR}/ThirdParty/OpenGV/build/lib/Debug/random_generators.lib) SET (G2OLIBS ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/bin/Release/g2o.lib) SET (DBOW2LIBS ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/Release/DBoW2.lib) SET (OPENGVLIBS ${PROJECT_SOURCE_DIR}/ThirdParty/OpenGV/build/lib/Release/opengv.lib) SET (RANDOMGENLIBS ${PROJECT_SOURCE_DIR}/ThirdParty/OpenGV/build/lib/Release/random_generators.lib) ELSE() SET (G2OLIBS ${PROJECT_SOURCE_DIR}/ThirdParty/g2o/lib/libg2o.so) SET (DBOW2LIBS ${PROJECT_SOURCE_DIR}/ThirdParty/DBoW2/lib/libDBoW2.so) SET (OPENGVLIBS ${PROJECT_SOURCE_DIR}/ThirdParty/OpenGV/build/lib/librandom_generators.a ${PROJECT_SOURCE_DIR}/ThirdParty/OpenGV/build/lib/libopengv.a) ENDIF() IF(WIN32) target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${Pangolin_LIBRARIES} optimized ${G2OLIBS} optimized ${DBOW2LIBS} optimized ${OPENGVLIBS} optimized ${RANDOMGENLIBS} debug ${G2OLIBS_DEBUG} debug ${DBOW2LIBS_DEBUG} debug ${OPENGVLIBS_DEBUG} debug ${RANDOMGENLIBS_DEBUG}) ELSE() target_link_libraries(${PROJECT_NAME} -lz -llog ${OpenCV_LIBS} ${OpenCV_LIBS_THIRD} ${Pangolin_LIBRARIES} ${G2OLIBS} ${DBOW2LIBS} ${OPENGVLIBS} ${RANDOMGENLIBS}) ENDIF() # Build examples MESSAGE("${PROJECT_NAME}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/Examples/Lafida) add_executable(multi_col_slam_lafida Examples/Lafida/mult_col_slam_lafida.cpp) target_link_libraries(multi_col_slam_lafida ${PROJECT_NAME})
openmp:
在执行时,找不到openmp链接,下载对应版本的src编译,我用的是android 9.0 所以使用如下链接下载源码:https://releases.llvm.org/9.0.0/openmp-9.0.0.src.tar.xz