linux + colmap 错误汇总

安装教程

官网教程:Installation — COLMAP 3.7 documentation

别人翻译:三维重建_COLMAP安装、使用和参数说明(翻译自官方文档)_一步一脚印-CSDN博客_colmap安装

错误汇总

1、git clone https://ceres-solver.googlesource.com/ceres-solver Cloning into 'ceres-solver'...
fatal: unable to access 'https://ceres-solver.googlesource.com/ceres-solver/': Failed to connect to 127.0.0.1 port 1080: Connection refused

解决方法:自己下载 ceres-solver

Download the package via the cmd:
wget http://ceres-solver.org/ceres-solver-1.9.0.tar.gz
and install it from source.

2、qt.qpa.screen: QXcbConnection: Could not connect to display Could not connect

首先

vim ~/.bashrc

然后把下面的这句话加进去,第一行就可以

export QT_QPA_PLATFORM='offscreen'

运行如下命令使配置生效

source ~/.bashrc

再次运行colmap gui,

GUI是用不了 用终端操作吧: 三维重建_COLMAP安装、使用和参数说明(翻译自官方文档)_一步一脚印-CSDN博客_colmap安装

3、改了一二天的错误

Describe the bug
CMakeOutput:
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.2.92 in /usr/include/eigen3
-- 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]
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- program_options
-- filesystem
-- graph
-- regex
-- system
-- unit_test_framework
-- Found Eigen
-- Includes : /usr/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 Glew
-- Includes : /usr/include
-- Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
-- Found Qt
-- Module : /usr/lib/x86_64-linux-gnu/cmake/Qt5Core
-- Module : /usr/lib/x86_64-linux-gnu/cmake/Qt5OpenGL
-- Module : /usr/lib/x86_64-linux-gnu/cmake/Qt5Widgets
-- Found CGAL
-- Includes : /usr/include
-- Libraries : /usr/lib/x86_64-linux-gnu/libCGAL.so.11.0.1
-- Build type not specified, using Release
-- Enabling SIMD support
-- Enabling OpenMP support
-- Disabling interprocedural optimization
-- Autodetected CUDA architecture(s): 6.1 6.1 6.1
-- Enabling CUDA support (version: 9.0, archs: sm_61)
-- Enabling OpenGL support
-- Disabling profiling support
-- Enabling CGAL support
-- Configuring done
-- Generating done

Build error with linking:

Scanning dependencies of target colmap
[ 58%] Building CXX object src/CMakeFiles/colmap.dir/util/bitmap.cc.o
[ 58%] Linking CXX static library libcolmap.a
[ 98%] Built target colmap
[100%] Linking CXX executable colmap
../libcolmap.a(bitmap.cc.o): In function char const* boost::re_detail::re_is_set_member<char const*, char, boost::regex_traits<char, boost::cpp_regex_traits<char> >, unsigned int>(char const*, char const*, boost::re_detail::re_set_long<unsigned int> const*, boost::re_detail::regex_data<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, bool)': bitmap.cc:(.text._ZN5boost9re_detail16re_is_set_memberIPKccNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_S8_S8_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost9re_detail16re_is_set_memberIPKccNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_S8_S8_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x145): undefined reference to boost::re_detail::cpp_regex_traits_implementation::transform_primary[abi:cxx11](char const*, char const*) const'
bitmap.cc:(.text._ZN5boost9re_detail16re_is_set_memberIPKccNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_S8_S8_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost9re_detail16re_is_set_memberIPKccNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_S8_S8_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x4a1): undefined reference to `boost::re_detail::cpp_regex_traits_implementation::transform[abi:cxx11](char const*, char const*) const'
collect2: error: ld returned 1 exit status
src/exe/CMakeFiles/colmap_exe.dir/build.make:143: recipe for target 'src/exe/colmap' failed
make[2]: *** [src/exe/colmap] Error 1
CMakeFiles/Makefile2:1184: recipe for target 'src/exe/CMakeFiles/colmap_exe.dir/all' failed
make[1]: *** [src/exe/CMakeFiles/colmap_exe.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

result:

I could finally solve it with cuda 9.0, gcc version 6 and boost version 1.58.0.
I was able to compile by removing the boost/regex dependency (I just replaced every boost:: for std:: in the bitmap.cc file, similar to what is suggested in this issue (#36), and removing the regex dependency in the CMakeLists.txt.

Here is what I did according to @BertaBescos 's comments to make it to compile:
(I have to replace boost::cmatch with std::cmatch too)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ffda4d..d6effb0 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,7 +90,6 @@ find_package(Boost REQUIRED COMPONENTS
              program_options
              filesystem
              graph
-             regex
              system
              unit_test_framework)
 
diff --git a/src/util/bitmap.cc b/src/util/bitmap.cc
index f59a22f..87bb533 100755
--- a/src/util/bitmap.cc
+++ b/src/util/bitmap.cc
@@ -34,7 +34,7 @@
 #include <unordered_map>
 
 #include <boost/filesystem/operations.hpp>
-#include <boost/regex.hpp>
+#include <regex>
 
 #include "base/camera_database.h"
 #include "VLFeat/imopv.h"
@@ -291,9 +291,9 @@ bool Bitmap::ExifFocalLength(double* focal_length) const {
   std::string focal_length_35mm_str;
   if (ReadExifTag(FIMD_EXIF_EXIF, "FocalLengthIn35mmFilm",
                   &focal_length_35mm_str)) {
-    const boost::regex regex(".*?([0-9.]+).*?mm.*?");
-    boost::cmatch result;
-    if (boost::regex_search(focal_length_35mm_str.c_str(), result, regex)) {
+    const std::regex regex(".*?([0-9.]+).*?mm.*?");
+    std::cmatch result;
+    if (std::regex_search(focal_length_35mm_str.c_str(), result, regex)) {
       const double focal_length_35 = std::stold(result[1]);
       if (focal_length_35 > 0) {
         *focal_length = focal_length_35 / 35.0 * max_size;
@@ -308,9 +308,9 @@ bool Bitmap::ExifFocalLength(double* focal_length) const {
 
   std::string focal_length_str;
   if (ReadExifTag(FIMD_EXIF_EXIF, "FocalLength", &focal_length_str)) {
-    boost::regex regex(".*?([0-9.]+).*?mm");
-    boost::cmatch result;
-    if (boost::regex_search(focal_length_str.c_str(), result, regex)) {
+    std::regex regex(".*?([0-9.]+).*?mm");
+    std::cmatch result;
+    if (std::regex_search(focal_length_str.c_str(), result, regex)) {
       const double focal_length_mm = std::stold(result[1]);
 
       // Lookup sensor width in database.
@@ -334,11 +334,11 @@ bool Bitmap::ExifFocalLength(double* focal_length) const {
           ReadExifTag(FIMD_EXIF_EXIF, "FocalPlaneXResolution", &x_res_str) &&
           ReadExifTag(FIMD_EXIF_EXIF, "FocalPlaneResolutionUnit",
                       &res_unit_str)) {
-        regex = boost::regex(".*?([0-9.]+).*?");
-        if (boost::regex_search(pixel_x_dim_str.c_str(), result, regex)) {
+        regex = std::regex(".*?([0-9.]+).*?");
+        if (std::regex_search(pixel_x_dim_str.c_str(), result, regex)) {
           const double pixel_x_dim = std::stold(result[1]);
-          regex = boost::regex(".*?([0-9.]+).*?/.*?([0-9.]+).*?");
-          if (boost::regex_search(x_res_str.c_str(), result, regex)) {
+          regex = std::regex(".*?([0-9.]+).*?/.*?([0-9.]+).*?");
+          if (std::regex_search(x_res_str.c_str(), result, regex)) {
             const double x_res = std::stold(result[2]) / std::stold(result[1]);
             // Use PixelXDimension instead of actual width of image, since
             // the image might have been resized, but the EXIF data preserved.
@@ -364,9 +364,9 @@ bool Bitmap::ExifFocalLength(double* focal_length) const {
 bool Bitmap::ExifLatitude(double* latitude) const {
   std::string str;
   if (ReadExifTag(FIMD_EXIF_GPS, "GPSLatitude", &str)) {
-    const boost::regex regex(".*?([0-9.]+):([0-9.]+):([0-9.]+).*?");
-    boost::cmatch result;
-    if (boost::regex_search(str.c_str(), result, regex)) {
+    const std::regex regex(".*?([0-9.]+):([0-9.]+):([0-9.]+).*?");
+    std::cmatch result;
+    if (std::regex_search(str.c_str(), result, regex)) {
       const double hours = std::stold(result[1]);
       const double minutes = std::stold(result[2]);
       const double seconds = std::stold(result[3]);
@@ -380,9 +380,9 @@ bool Bitmap::ExifLatitude(double* latitude) const {
 bool Bitmap::ExifLongitude(double* longitude) const {
   std::string str;
   if (ReadExifTag(FIMD_EXIF_GPS, "GPSLongitude", &str)) {
-    const boost::regex regex(".*?([0-9.]+):([0-9.]+):([0-9.]+).*?");
-    boost::cmatch result;
-    if (boost::regex_search(str.c_str(), result, regex)) {
+    const std::regex regex(".*?([0-9.]+):([0-9.]+):([0-9.]+).*?");
+    std::cmatch result;
+    if (std::regex_search(str.c_str(), result, regex)) {
       const double hours = std::stold(result[1]);
       const double minutes = std::stold(result[2]);
       const double seconds = std::stold(result[3]);
@@ -396,9 +396,9 @@ bool Bitmap::ExifLongitude(double* longitude) const {
 bool Bitmap::ExifAltitude(double* altitude) const {
   std::string str;
   if (ReadExifTag(FIMD_EXIF_GPS, "GPSAltitude", &str)) {
-    const boost::regex regex(".*?([0-9.]+).*?/.*?([0-9.]+).*?");
-    boost::cmatch result;
-    if (boost::regex_search(str.c_str(), result, regex)) {
+    const std::regex regex(".*?([0-9.]+).*?/.*?([0-9.]+).*?");
+    std::cmatch result;
+    if (std::regex_search(str.c_str(), result, regex)) {
       *altitude = std::stold(result[1]) / std::stold(result[2]);
       return true;
     }

### 回答1: 要在Linux上安装COLMAP,您可以按照以下步骤进行操作: 1. 首先,您需要下载COLMAP的源代码。您可以从官方网站(https://colmap.github.io/)下载最新版本的源代码。 2. 解压缩下载的源代码文件,并进入解压缩后的目录。 3. 接下来,您需要安装一些依赖项。您可以使用以下命令安装这些依赖项: sudo apt-get install cmake libboost-program-options-dev libboost-filesystem-dev libboost-graph-dev libboost-regex-dev libboost-system-dev libboost-test-dev libeigen3-dev libsuitesparse-dev libfreeimage-dev libgoogle-glog-dev libgflags-dev libglew-dev qtbase5-dev libqt5opengl5-dev 4. 在安装完所有依赖项后,您可以使用以下命令编译和安装COLMAP: mkdir build cd build cmake .. make sudo make install 5. 安装完成后,您可以使用以下命令运行COLMAPcolmap 希望这可以帮助您安装COLMAP。 ### 回答2: Colmap是一个非常强大的计算机视觉软件,它可以识别照片中的物体并将它们以三维形式呈现出来。要在Linux系统上安装Colmap,请按照以下步骤: 1. 为了安装Colmap,你需要先安装一些必要的依赖项。打开终端并输入以下命令:sudo apt-get update sudo apt-get install git cmake build-essential libboost-dev libboost-program-options-dev libboost-serialization-dev libboost-filesystem-dev libqt5opengl5-dev libpng-dev libjpeg-dev libtiff-dev libglu1-mesa-dev libglew-dev libglfw3-dev libxi-dev libxrandr-dev libx11-dev libatlas-base-dev libeigen3-dev 2. 下载Colmap源代码。你可以使用以下命令将源代码克隆到你的系统中:git clone https://github.com/colmap/colmap.git 3. 进入源代码文件夹,输入以下命令进行编译:cd colmap mkdir build cd build cmake .. make -j4 # 使用4个线程进行编译 sudo make install 4. 安装完成后,输入“colmap”命令来启动Colmap程序。 以上就是在Linux系统上安装Colmap的步骤。需要注意的是,在安装过程中可能会遇到各种各样的问题,如缺少依赖项、编译错误等等。如果你无法解决这些问题,可以在Colmap的官方网站上查找相关文档或提交问题报告。 ### 回答3: Colmap是一种开源的三维重建软件,它在计算机视觉和图像处理领域应用广泛,并且在Linux系统上支持良好。本文将介绍如何在Linux上安装Colmap。 1.准备环境 在安装Colmap之前,需要保证Linux系统中已经安装好以下软件: - cmake - eigen - gflags - glew - glog - opencv - protobuf - zlib 如果没有安装,可以使用以下命令进行安装: sudo apt-get install cmake libeigen3-dev libgflags-dev libglew-dev libgoogle-glog-dev libopencv-dev protobuf-compiler zlib1g-dev 2.下载Colmap源代码 可以从Colmap的官方网站或者Github仓库中下载源代码。此处假设将源代码下载到/user/local/src目录下。 cd /usr/local/src git clone https://github.com/colmap/colmap.git 3.编译和安装Colmap 进入Colmap源代码目录,并创建一个build目录,然后执行cmake和make命令编译和安装Colmap。 cd colmap mkdir build cd build cmake .. make sudo make install 4.测试Colmap安装成功 在Linux终端执行以下命令,如果输出Colmap的版本号,则说明Colmap已经安装成功。 colmap -h 总之,在Linux上安装Colmap需要先准备好环境,然后从官网或者Github仓库下载源代码,最后使用cmake和make进行编译和安装。简单易懂,并且很方便实现。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值