安装教程
官网教程:Installation — COLMAP 3.7 documentation
别人翻译:三维重建_COLMAP安装、使用和参数说明(翻译自官方文档)_一步一脚印-优快云博客_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安装、使用和参数说明(翻译自官方文档)_一步一脚印-优快云博客_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;
}