colmap在ubuntu18.04下的配置

colmap介绍
官方教程:https://colmap.github.io/install.html#
具体安装可以参考:中文翻译版

有几个地方需要注意,安装colmap的前提需要安装Ceres Solver优化库,而Ceres Solver优化库又有与其对应的Eigen库需要安装(要注意适合你自己的版本)。

colmap在make的时候。需要QT5来编译,如果你的电脑里面有装anaconda的话,anaconda自带的QT5会和你系统的QT5冲突导致安装失败,我之前没注意这个问题,装colmap的时候直接cmake…

(base) smile@smile-X3-S-Series-GK7MR0R:~/app_install/colmap/build$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found required Ceres dependency: Eigen version 3.3.1 in /usr/local/share/eigen3/cmake
-- Found required Ceres dependency: glog
-- Found required Ceres dependency: gflags
-- Found Ceres version: 2.0.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, Multithreading]
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   graph
--   system
--   unit_test_framework
-- Found Eigen3: /usr/local/include/eigen3 (Required is at least version "2.91.0") 
-- Found Eigen
--   Includes : /usr/local/include/eigen3
-- Found FreeImage
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so
-- Found Glog
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libglog.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- Found Glew
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
-- Found Git: /usr/bin/git (found version "2.17.1") 
CMake Error at /home/smile/Downloads/yes/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:15 (message):
  The imported target "Qt5::Core" references the file

     "/home/smile/Downloads/yes/include/qt/"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/home/smile/Downloads/yes/lib/cmake/Qt5Core/Qt5CoreConfig.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /home/smile/Downloads/yes/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:51 (_qt5_Core_check_file_exists)
  /home/smile/Downloads/yes/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)
  CMakeLists.txt:119 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/smile/app_install/colmap/build/CMakeFiles/CMakeOutput.log".
See also "/home/smile/app_install/colmap/build/CMakeFiles/CMakeError.log".

然后我:conda deactivate
在cmake …
发现还是报相同的错误
我在colmap文件夹下的cmakelists里为QT5添加了我自己的路径,
/home/smile/app_install/colmap/CMakeLists.txt

if(GUI_ENABLED)
    find_package(Qt5 5.4 COMPONENTS Core OpenGL Widgets )
    if(Qt5_FOUND)
        message(STATUS "Found Qt")
        message(STATUS "  Module : ${Qt5Core_DIR}")
        message(STATUS "  Module : ${Qt5OpenGL_DIR}")
        message(STATUS "  Module : ${Qt5Widgets_DIR}")

添加PATH /usr/lib/x86_64-linux-gnu/cmake

if(GUI_ENABLED)
    find_package(Qt5 5.4 COMPONENTS Core OpenGL Widgets PATH /usr/lib/x86_64-linux-gnu/cmake)
    if(Qt5_FOUND)
        message(STATUS "Found Qt")
        message(STATUS "  Module : ${Qt5Core_DIR}")
        message(STATUS "  Module : ${Qt5OpenGL_DIR}")
        message(STATUS "  Module : ${Qt5Widgets_DIR}")

/home/smile/app_install/colmap/CMakeLists.txt

然后cmake … 还是报错,

make: *** No targets specified and no makefile found. Stop.

查看当前环境变量

echo $PATH
/usr/local/cuda-11.4/bin:/home/smile/miniconda3/condabin:/home/smile/Downloads/yes/bin:/opt/ros/melodic/bin:/home/smile/.local/bin:/home/smile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

然后去除和miniconda(anaconda相关的!)/home/smile/miniconda3/condabin:/home/smile/Downloads/yes/bin:把这部分去掉了

export PATH=/opt/ros/melodic/bin:/home/smile/.local/bin:/home/smile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

然后

smile@smile-X3-S-Series-GK7MR0R:~/app_install/colmap/build$ cmake .. -DQt5_DIR=/usr/lib/x86_64-linux-gnu/qt5



[ 95%] Building CXX object src/CMakeFiles/colmap_cuda.dir/util/cudacc.cc.o
[ 95%] Linking CXX static library libcolmap_cuda.a
[ 95%] Built target colmap_cuda
Scanning dependencies of target colmap_exe
[ 95%] Building CXX object src/exe/CMakeFiles/colmap_exe.dir/colmap.cc.o
[ 95%] Building CXX object src/exe/CMakeFiles/colmap_exe.dir/database.cc.o
[ 97%] Building CXX object src/exe/CMakeFiles/colmap_exe.dir/feature.cc.o
[ 97%] Building CXX object src/exe/CMakeFiles/colmap_exe.dir/gui.cc.o
[ 97%] Building CXX object src/exe/CMakeFiles/colmap_exe.dir/image.cc.o
[ 97%] Building CXX object src/exe/CMakeFiles/colmap_exe.dir/model.cc.o
[ 97%] Building CXX object src/exe/CMakeFiles/colmap_exe.dir/mvs.cc.o
[100%] Building CXX object src/exe/CMakeFiles/colmap_exe.dir/sfm.cc.o
[100%] Building CXX object src/exe/CMakeFiles/colmap_exe.dir/vocab_tree.cc.o
[100%] Linking CXX executable colmap
[100%] Built target colmap_exe
最后就安装成功了

接下来记得把miniconda(或者anaconda相关)的路径添加回来,不然miniconda(或者anaconda)的使用可能会出问题。

export PATH=/usr/local/cuda-11.4/bin:/home/smile/miniconda3/condabin:/home/smile/Downloads/yes/bin:/opt/ros/melodic/bin:/home/smile/.local/bin:/home/smile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

接下来安装一下启动界面,就可以使用了

sudo apt install colmap

colmap gui

最后提一下,因为Eigen下载地址和Ceres Solver的版本问题,你可能需要重装Eigen、重装Ceres Solver:
1.删除你安装的文件夹所有的内容
在这里插入图片描述
我安装在这里,把这两个文件夹删除,(sudo rm -rf pakagename)

/usr/local/include 文件夹下删除相关文件在这里插入图片描述
/usr/local/lib/cmake 文件夹下删除相关文件在这里插入图片描述
可以使用类似于:
sudo rm -rf /usr/local/include/ceres
sudo rm -rf /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/lib/libceres.a

这个冲突解决方法在:

一个colmap的基本使用教程
colmap的参数设置使用教程
安装colmap前最好不要装anaconda,有人已安装,就将anaconda的相关环境变量注释掉sudo gedit ~/.bashrc 注释后更新source ~/.bashrc ,还是不行 后来运行了修复语句,然后就可以安装:
安装修复:sudo apt-get -f install
安装MeshLab:sudo apt-get install meshlab

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大家好我是科林

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值