0. Based on
1. Install dependencies
sudo apt-get install \
libgtk2.0-dev \
libglew-dev \
glew-utils \
libdevil-dev \
libboost-all-dev \
libatlas-cpp-0.6-dev \
libatlas-dev \
imagemagick \
libcminpack-dev \
libgfortran3 \
libmetis-edf-dev \
libparmetis-dev \
freeglut3-dev \
libgsl-dev \
2. CUDA Setup (Optional)
sudo dpkg -i cuda-repo-ubuntu1604_9.1.85-1_amd64.deb
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
sudo apt update
sudo apt install cuda
3. VisualSFM Setup
- download
wget http://ccwu.me/vsfm/download/VisualSFM_linux_64bit.zip
- extract
unzip VisualSFM_linux_64bit.zip rm VisualSFM_linux_64bit.zip
4. SiftGPU Setup
- download
cd ~/vsfm wget https://github.com/pitzer/SiftGPU/archive/master.zip
- extract
unzip master.zip rm master.zip mv SiftGPU-master SiftGPU
- generate the shared object
libsiftgpu.so
and copy to ~/vsfm/bincd ~/vsfm/SiftGPU make cp ~/vsfm/SiftGPU/bin/libsiftgpu.so ~/vsfm/bin
- change the settings at ~/vsfm/SiftGPU/makefile
- set
siftgpu_disable_devil = 1
in the makefile to drop the dependency on DevIL
- set
5. pba (Multicore Bundle Adjustment) Setup
- download
cd ~/vsfm wget http://grail.cs.washington.edu/projects/mcba/pba_v1.0.5.zip
- extract
unzip pba_v1.0.5.zip rm pba_v1.0.5.zip
- modification for some files
- add
#include <stdlib.h>
at the top of the following two files
(~/vsfm/pba/src/pba/SparseBundleCU.h and ~/vsfm/pba/src/pba/pba.h) - you can also copy and paste the commands below
cd ~/vsfm/pba # echo -e "#include <stdlib.h>\n$(cat ~/vsfm/pba/src/pba/SparseBundleCU.h)" > ~/vsfm/pba/src/pba/SparseBundleCU.h # echo -e "#include <stdlib.h>\n$(cat ~/vsfm/pba/src/pba/pba.h)" > ~/vsfm/pba/src/pba/pba.h
- add
- for all graphic cards, generate the shared object
libpba_no_gpu.so
and copy to ~/vsfm/binmake -f makefile_no_gpu cp ~/vsfm/pba/bin/libpba_no_gpu.so ~/vsfm/bin/
6. PMVS Setup
- download
cd ~/vsfm wget http://www.di.ens.fr/pmvs/pmvs-2.tar.gz
- extract
tar xvzf pmvs-2.tar.gz rm pmvs-2.tar.gz
- hack
cd ~/vsfm/pmvs-2/program/main/ cp ~/vsfm/pmvs-2/program/main/mylapack.o ~/vsfm/pmvs-2/program/main/mylapack.o.backup make clean cp ~/vsfm/pmvs-2/program/main/mylapack.o.backup ~/vsfm/pmvs-2/program/main/mylapack.o make depend make
7. Graclus1.2 Setup
- download
cd ~/vsfm wget http://www.cs.utexas.edu/users/dml/Software/graclus1.2.tar.gz
- extract
tar xvzf graclus1.2.tar.gz rm graclus1.2.tar.gz
- modification for the file ~/vsfm/graclus1.2/Makefile.in
- replace COPTIONS = -DNUMBITS=32 by
COPTIONS = -DNUMBITS=64
- you can also copy and paste the command below
sed -i 's/COPTIONS = -DNUMBITS=32/COPTIONS = -DNUMBITS=64/' ~/vsfm/graclus1.2/Makefile.in
- replace COPTIONS = -DNUMBITS=32 by
- makefile
make
8. CMVS Setup
- download
cd ~/vsfm wget http://www.di.ens.fr/cmvs/cmvs-fix2.tar.gz
- extract
tar xvzf cmvs-fix2.tar.gz rm cmvs-fix2.tar.gz
- hack
cp ~/vsfm/pmvs-2/program/main/mylapack.o ~/vsfm/cmvs/program/main/
- modification for some files
- add
#include <vector>
and#include <numeric>
at the top of the file (~/vsfm/cmvs/program/base/cmvs/bundle.cc) - add
#include <stdlib.h>
at the top of the file (~/vsfm/cmvs/program/main/genOption.cc) - in the file ~/vsfm/cmvs/program/main/Makefile
(check the red colored words below)#
Your INCLUDE path (e.g., -I/usr/include)#
YOUR_INCLUDE_PATH =#
Your metis directory (contains header files under graclus1.2/metisLib/)#
Your LDLIBRARY path (e.g., -L/usr/lib)- YOUR_INCLUDE_METIS_PATH =
-I/home/scott/vsfm/graclus1.2/metisLib
- YOUR_LDLIB_PATH =
-L/home/scott/vsfm/graclus1.2
- you can also copy and paste the command below
echo -e "#include <vector>\n#include <numeric>\n$(cat ~/vsfm/cmvs/program/base/cmvs/bundle.cc)" > ~/vsfm/cmvs/program/base/cmvs/bundle.cc echo -e "#include <stdlib.h>\n$(cat ~/vsfm/cmvs/program/main/genOption.cc)" > ~/vsfm/cmvs/program/main/genOption.cc sed -e '/Your INCLUDE path*/ s/^#*/#/' -i ~/vsfm/cmvs/program/main/Makefile sed -e '/YOUR_INCLUDE_PATH*/ s/^#*/#/' -i ~/vsfm/cmvs/program/main/Makefile sed -e '/Your metis directory*/ s/^#*/#/' -i ~/vsfm/cmvs/program/main/Makefile sed -e '/Your LDLIBRARY path*/ s/^#*/#/' -i ~/vsfm/cmvs/program/main/Makefile sed -i "s:YOUR_INCLUDE_METIS_PATH =*:YOUR_INCLUDE_METIS_PATH = -I$HOME/vsfm/graclus1.2/metisLib:" ~/vsfm/cmvs/program/main/Makefile sed -i "s:YOUR_LDLIB_PATH =*:YOUR_LDLIB_PATH = -L$HOME/vsfm/graclus1.2:" ~/vsfm/cmvs/program/main/Makefile
- add
- hack
cd ~/vsfm/cmvs/program/main make cp ~/vsfm/cmvs/program/main/cmvs ~/vsfm/bin cp ~/vsfm/cmvs/program/main/pmvs2 ~/vsfm/bin cp ~/vsfm/cmvs/program/main/genOption ~/vsfm/bin
9. Run VisualSFM
- add VisualSFM to your path and LD_LIBRARY_PATH
~/.bashrc
- add the following two commands in .bashrc
export PATH=$PATH:$HOME/vsfm/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/vsfm/bin
- and then
source ~/.bashrc
- makefile
cd ~/vsfm make
- install some packages if the make command failed
sudo apt install mesa-utils sudo apt-get install freeglut3-dev sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev libosmesa-dev
- run VisualSFM
VisualSFM&