Colmap在centos7下的编译

Colmap在centos7下的编译

1.什么是colmap

COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline with a graphical and command-line interface. It offers a wide range of features for reconstruction of ordered and unordered image collections.

2.gcc升级到5.4

可以到官网下载gcc,也可以直接在这里下载:http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/ 下载好后进行编译安装

tar -xvf gcc-5.4.0.tar.bz2
cd gcc-5.4.0
./contrib/download_prerequisits
mkdir build
cd build
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make(建议不要使用make -j来编译,虽然可以缩短编译时间,但极大可能会编译失败)
make install

mv gcc gcc-old
mv g++ g++-old
mv c++ c++-old
ls -s /usr/local/bin/gcc /usr/bin/gcc
ln -s /usr/local/bin/g++ /usr/bin/g++
ln -s /usr/local/bin/c++ /usr/bin/c++​

3.基础包的安装

yum install -y 
    cmake 
    build-essential 
    libeigen3-dev 
    libsuitesparse-dev 
    libglew-dev 
    freeglut3-dev 
    qt5-default 
    libxmu-dev 
    libxi-dev

4.boost库的安装

Boost源代码下载地址:http://www.boost.org/users/download/。

./bootstrap.sh –prefix=/usr/local/

执行完上一条命令之后可以执行命令
./b2编译然。也可以直接执行下面安装命令
./b2 install或者./bjam install

5.gflags 编译安装

https://github.com/gflags/gflags 下载源码

编译gflags为动态库
cmake .. -DBUILD_SHARED_LIBS=ON
编译安装
make -j2 && sudo make -j2 install

6.glog 编译安装

https://github.com/google/glog 下载源码

执行./autogen.sh && ./configure && make && make install 编译安装

如果遇到编译glog遇到automake问题:

make AUTOCONF=: AUTOHEADER=: AUTOMAKE=: ACLOCAL=:
make install AUTOCONF=: AUTOHEADER=: AUTOMAKE=: ACLOCAL=:

7.freeimage 编译安装

https://github.com/leapmotion/FreeImage 下载源码

执行make && make install

8.ceres-solver 编译安装

https://github.com/ceres-solver/ceres-solver 下载源码

mkdir build && cd build && cmake .. && make -j3 && make install

9.libstd的链接

ln -s /usr/local/lib64/libstdc++.6.so /usr/lib64/libstd++.6.so

10.升级显卡驱动

默认安装的是mesa驱动
查看显卡类型:lspci | grep -i vga

查看opengles的支持类型
glxinfo | grep 'OpenGL'

参考 http://blog.csdn.net/alex_my/article/details/44705663

11.编译安装colmap

https://github.com/colmap/colmap 下载代码

mkdir build && cmake .. && make
原文地址:https://www.cnblogs.com/zhulongchao/p/6851970.html