meshroom是一个比较好的开源三维重建软件,以alicevision为基础。
alicevision
cmake
首先安装升级cmake版本,ubuntu16自带cmake为3.5,将其升级到3.16
sudo apt-get remove cmake
cd /usr/src
wget https://github.com/Kitware/CMake/releases/download/v3.16.0/cmake-3.16.0.tar.gz
tar -zxvf cmake-3.16.0.tar.gz
cd cmake-3.16.0
apt install libssl-dev build-essential
./bootstrap && make && sudo make install
openexr
openexr的版本在alicevision中有指定,我需要的是2.5.3的版本
wget -c https://github.com/AcademySoftwareFoundation/openexr/archive/v2.5.3.zip
unzip -q v2.5.3.zip
cd openexr-2.5.3 && mkdir build && cd build
cmake -LAH .. && make -j4 && sudo make install
boost1.74
wget -c https://dl.bintray.com/boostorg/release/1.74.0/source/boost_1_74_0.tar.gz
tar -zxvf boost_1_74_0.tar.gz
cd boost_1_74_0
./bootstrap.sh
sudo ./b2 install
openimageio
https://github.com/OpenImageIO/oiio/blob/master/INSTALL.md
我这里没有绑定python
git clone --depth 1 https://github.com/OpenImageIO/oiio.git
cd oiio && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DSTOP_ON_WARNING=0 -DUSE_PYTHON=0 ..
make -j4 && sudo make install && make clean
eigen 3.3.7
alicevision中指定eigen版本3.3.7
下载
wget -c https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip
unzip -q eigen-3.3.7.zip
cd eigen-3.3.7 && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
sudo make install
sudo cp -r /usr/local/include/eigen3 /usr/include
ceres 1.14.0
http://ceres-solver.org/installation.html
alicevision中指定ceres版本1.14.0
sudo apt-get install libatlas-base-dev
sudo apt-get install libgoogle-glog-dev libgflags-dev
sudo apt-get install libsuitesparse-dev
wget -c https://github.com/ceres-solver/ceres-solver/archive/1.14.0.zip
unzip -q 1.14.0.zip
cd ceres-solver-1.14.0 && mkdir build && cd build
cmake .. && make -j4 && sudo make install && make clean
Geogram 1.7.5
alicevision中指定geogram版本1.7.5
http://alice.loria.fr/software/geogram/doc/html/geogram_compiling.html
wget -c https://gforge.inria.fr/frs/download.php/file/38315/geogram_1.7.5.zip
sh -f configure.sh
cd build/Linux64-gcc-dynamic-Release
make -j4
sudo make install
opengv
git clone --depth 1 https://github.com/alicevision/opengv.git --branch=cmake_fix_install
cd opengv && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release .. && make -j4
sudo make install
opencv4.1.0
sudo apt -y remove x264 libx264-dev
## Install dependencies
sudo apt -y install build-essential checkinstall cmake pkg-config yasm
sudo apt -y install git gfortran
sudo apt -y install libjpeg8-dev libjasper-dev libpng12-dev
sudo apt -y install libtiff5-dev
sudo apt -y install libtiff-dev
sudo apt -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt -y install libxine2-dev libv4l-dev
cd /usr/include/linux
sudo ln -s -f ../libv4l1-videodev.h videodev.h
cd $cwd
sudo apt -y install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
sudo apt -y install libgtk2.0-dev libtbb-dev qt5-default
sudo apt -y install libatlas-base-dev
sudo apt -y install libfaac-dev libmp3lame-dev libtheora-dev
sudo apt -y install libvorbis-dev libxvidcore-dev
sudo apt -y install libopencore-amrnb-dev libopencore-amrwb-dev
sudo apt -y install libavresample-dev
sudo apt -y install x264 v4l-utils
# Optional dependencies
sudo apt -y install libprotobuf-dev protobuf-compiler
sudo apt -y install libgoogle-glog-dev libgflags-dev
sudo apt -y install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen
alicevision中指定opencv版本4.1.0,并有contrib
mkdir opencv && cd opencv
wget -c https://github.com/opencv/opencv/archive/4.1.0.tar.gz -O opencv.tar.gz
wget -c https://github.com/opencv/opencv_contrib/archive/4.1.0.tar.gz -O contrib.tar.gz
mkdir build && build
由于在opencv3之后,使用cmake都会从github上下载ippicv, vgg等,那么
pchain cmake -DCMAKE_BUILD_TYPE=RELEASE\
-DWITH_TBB=ON\
-DWITH_V4L=ON\
-DWITH_QT=ON\
-DWITH_OPENGL=ON\
-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.1.0/modules\
-DWITH_CUDA=ON\
-DBUILD_opencv_cudacodec=OFF\
-DENABLE_FAST_MATH=1\
-DCUDA_FAST_MATH=1\
-DWITH_CUBLAS=1\
-DBUILD_EXAMPLES=OFF\
../opencv-4.1.0
make -j8
sudo make install && make clean
编译安装
git clone https://github.com/alicevision/AliceVision.git --recursive
cd AliceVision && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release .. && make -j4
meshroom
python 环境
Linux: Python 3 (>=3.5) or Python 2 (>= 2.7)
conda create -n meshroom python=3.6
conda activate meshroom
pip install -U pip
pip install -r requirements.txt -r dev_requirements.txt
Qt 插件
QT5
https://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/5.13/5.13.2/
chmod +x qt-opensource-linux-x64-5.13.2.run
sudo ./qt-opensource-linux-x64-5.13.2.run
qt的安装地址在/opt
这一步时间会比较长
QmlAlembic
首先安装Alembic
git clone --depth 1 https://github.com/alembic/alembic
cd alembic
mkdir build && cd build
make -j4
sudo make install
export QT_DIR=/opt/qt/5.11.0/gcc_64
cmake .. -DCMAKE_PREFIX_PATH=$QT_DIR -DCMAKE_BUILD_TYPE=Release
sudo make install
安装地址为/usr/local/qml