按以下代码一步步操作
conda create -n NerfingMVS python=3.7
conda activate NerfingMVS
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 -c pytorch
pip install -r requirements.txt
https://colmap.github.io/install.html
Linux 中
建议的依赖: CUDA(版本至少7.X)
依赖默认Ubuntu仓库:
sudo apt-get install \
git \
cmake \
ninja-build \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libeigen3-dev \
libflann-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgtest-dev \
libsqlite3-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev \
libceres-dev
配置和编制COLMAP:
git clone https://github.com/colmap/colmap.git
cd colmap
mkdir build
cd build
cmake .. -GNinja
ninja
sudo ninja install
在cmake … -GNinja时出现报错
– Boost found.
– Found Boost components: filesystem;graph;program_options;system
– Found FreeImage
– Includes : /usr/include
– Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so CMake Error at cmake/FindFreeImage.cmake:96 (target_include_directories): Cannot
specify include directories for imported target
“freeimage::FreeImage”. Call Stack (most recent call first):
cmake/FindDependencies.cmake:15 (find_package) CMakeLists.txt:96
(include)CMake Error at cmake/FindFreeImage.cmake:98 (target_link_libraries):
Cannot specify link libraries for target “freeimage::FreeImage” which
is not built by this project. Call Stack (most recent call first):
cmake/FindDependencies.cmake:15 (find_package) CMakeLists.txt:96
(include)– Configuring incomplete, errors occurred! See also “/home/uriky/桌面/NerfingMVS-main/colmap/build/CMakeFiles/CMakeOutput.log”.
尝试更新cmake看看能不能解决
https://github.com/Kitware/CMake/releases/进入下载cmake的安装包
cmake -version
which cmake
sudo ln -sf /home/uriky/cmake-3.29.3-linux-x86_64/bin/* /usr/bin/#将安装包解压之后设置软链接
cmake -version
重新运行一遍cmake … -GNinja刚刚的错误消失了,猜测可能是cmake的版本问题导致之前的错误,现在出现了新的错误
1、 CMake Error at cmake/FindLZ4.cmake:91 (message): Could not find LZ4
2、Call Stack (most recent call first): cmake/FindDependencies.cmake:18
3、(find_package) CMakeLists.txt:96 (include)
先解决第一个安装这个LZ4的包,安装代码如下
sudo apt install liblz4-dev
再次进行一遍 cmake … -GNinja,错误解决,但是出现了警告
CMake Warning at cmake/CMakeHelper.cmake:103 (add_executable):
Cannot generate a safe runtime search path for target colmap_main
because files in some directories may conflict with libraries in
implicit directories:runtime library [libgmp.so.10] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /home/uriky/anaconda3/lib runtime library [liblz4.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /home/uriky/anaconda3/lib runtime library [libsqlite3.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /home/uriky/anaconda3/lib runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /home/uriky/anaconda3/lib runtime library [libgomp.so.1] in /usr/lib/gcc/x86_64-linux-gnu/7 may be hidden by files in: /home/uriky/anaconda3/lib
Some of these libraries may not be found correctly. Call Stack (most
recent call first): src/colmap/exe/CMakeLists.txt:67
(COLMAP_ADD_EXECUTABLE)
警告就不管了,解决完错误,继续上述ninja代码 报错了(待解决)
FAILED:
src/colmap/mvs/CMakeFiles/colmap_mvs_cuda.dir/gpu_mat_prng.cu.o
/usr/local/cuda-10.0/bin/nvcc -DBOOST_ALL_NO_LIB
-DBOOST_FILESYSTEM_DYN_LINK -DBOOST_GRAPH_DYN_LINK -DBOOST_REGEX_DYN_LINK -DCOLMAP_CGAL_ENABLED -DCOLMAP_CUDA_ENABLED -DCOLMAP_GPU_ENABLED -DCOLMAP_GUI_ENABLED -DCOLMAP_OPENGL_ENABLED -DCOLMAP_OPENMP_ENABLED -DGFLAGS_IS_A_DLL=0 -DGLOG_VERSION_MAJOR=0 -DGLOG_VERSION_MINOR=5 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -I/home/uriky/桌面/NerfingMVS-main/colmap/src -isystem /home/uriky/anaconda3/inude -isystem /usr/include/eigen3 -isystem
/home/uriky/anaconda3/include/qt -isystem
/home/uriky/anaconda3/include/qt/QtCore -isystem
/home/uriky/anaconda3/./mkspecs/linux-g++ -isystem
/home/uriky/anaconda3/include/qt/QtOpenGL -isystem
/home/uriky/anaconda3/include/qt/QtWidgets -isystem
/home/uriky/anaconda3/include/qt/QtGui -isystem
/usr/local/cuda-10.0/include -Wno-deprecated-gpu-targets
–compiler-options -fPIC --use_fast_math --default-stream per-thread -Xptxas=-suppress-stack-size-warning -O3 -DNDEBUG -std=c++14 “–generate-code=arch=compute_89,code=[sm_89]” -Xcompiler=-fPIC -x cu
-c ‘/home/uriky/桌面/NerfingMVS-main/colmap/c/colmap/mvs/gpu_mat_prng.cu’
-o src/colmap/mvs/CMakeFiles/colmap_mvs_cuda.dir/gpu_mat_prng.cu.o && /usr/local/cuda-10.0/bin/nvcc -DBOOST_ALL_NO_LIB
-DBOOST_FILESYSTEM_DYN_LINK -DBOOST_GRAPH_DYN_LINK -DBOOST_REGEX_DYN_LINK -DCOLMAP_CGAL_ENABLED -DCOLMAP_CUDA_ENABLED -DCOLMAP_GPU_ENABLED -DCOLMAP_GUI_ENABLED -DCOLMAP_OPENGL_ENABLED -DCOLMAP_OPENMP_ENABLED -DGFLAGS_IS_A_DLL=0 -DGLOG_VERSION_MAJOR=0 -DGLOG_VERSION_MINOR=5 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -I/home/uriky/桌面/NerfingMVS-main/colmap/src -isystem /home/uriky/anaconda3/include -isystem /usr/include/eigen3 -isystem
/home/uriky/ananda3/include/qt -isystem
/home/uriky/anaconda3/include/qt/QtCore -isystem
/home/uriky/anaconda3/./mkspecs/linux-g++ -isystem
/home/uriky/anaconda3/include/qt/QtOpenGL -isystem
/home/uriky/anaconda3/include/qt/QtWidgets -isystem
/home/uriky/anaconda3/include/qt/QtGui -isystem
/usr/local/cuda-10.0/include -Wno-deprecated-gpu-targets
–compiler-options -fPIC --use_fast_math --default-stream per-thread -Xptxas=-suppress-stack-size-warning -O3 -DNDEBUG -std=c++14 “–generate-code=arch=compute_89,code=[sm_89]” -Xcompiler=-fPIC -x cu
-M ‘/home/uriky/桌面/NerfingMVS-main/colmap/src/colmap/mvs/gpu_mat_prng.cu’
-MT src/colmap/mvs/CMakeFil/colmap_mvs_cuda.dir/gpu_mat_prng.cu.o -o src/colmap/mvs/CMakeFiles/colmap_mvs_cuda.dir/gpu_mat_prng.cu.o.d nvcc
fatal : Unsupported gpu architecture ‘compute_89’ [59/213] Building
CXX object src/colmap/mvs/CMakeFiles/colmap_mvs.dir/meshing.cc.o In
file included from /usr/include/CGAL/Triangulation_3.h:62:0,
from /usr/include/CGAL/Delaunay_triangulation_3.h:40,
from /home/uriky/桌面/NerfingMVS-main/colmap/src/colmap/mvs/meshing.cc:37:
/home/uriky/anaconda3/include/boost/bind.hpp:41:1: note: #pragma
message: The practice of declaring the Bind placeholders (_1, _2, …)
in the global namespace is deprecated. Please use
<boost/bind/bind.hpp> + using namespace boost::placeholders, or define
BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior. ) ^
ninja: build stopped: subcommand failed.
成功后进行下一步运行COLMAP:
colmap -h
colmap gui
汇编与 CUDA支助 ,也安装Ubuntu的默认CUDA包:
sudo apt-get install -y \
nvidia-cuda-toolkit \
nvidia-cuda-toolkit-gcc
或者,手动安装最新的CUDA从独的主页。 在CMake配置 指定 CMAKE_CUDA_ARCHITECTURES 为"本土",如果你想要跑COLMAP你 当前的机器,“所有”/“所有主要的”,以便能够将其分发给其他机, 或者一个具体CUDA构,如"75",等等。