OpenSfM code is available at Github. The simplest way to get the code is to clone the repository and its submodules with:
git clone --recursive https://github.com/mapillary/OpenSfM
If you already have the code or you downloaded a release, make sure to update the submodules with:
cd OpenSfM git submodule update --init --recursive
OpenSfM depends on the following libraries that need to be installed before building it.
Installing dependencies on Ubuntu¶
If using Python 2, see this Dockerfile for the commands to install all dependencies on Ubuntu 16.04.
If using Python 3, follow the process here Dockerfile.python3.
The main steps are
- Install OpenCV, NumPy, SciPy using apt-get
- Install python requirements using pip
- Clone, build and install OpenGV following the receipt in the Dockerfile
- Build and Install the Ceres solver from its source using the
Installing dependencies on MacOSX¶
Install OpenCV and the Ceres solver using:
brew tap homebrew/science brew install opencv brew install ceres-solver sudo pip install -r requirements.txt
And install OpenGV using:
brew install eigen git clone https://github.com/paulinus/opengv.git cd opengv/build cmake .. -DBUILD_TESTS=OFF -DBUILD_PYTHON=ON make install
Make sure you update your
PYTHONPATH to include
/usr/local/lib/python2.7/site-packages where OpenCV and OpenGV have been installed. For example with:
Note on OpenCV 3 When running OpenSfM on top of OpenCV version 3.0 the OpenCV Contrib modules are required for extracting SIFT or SURF features.
Building the library¶
Once the dependencies have been installed, you can build OpenSfM by running the following command from the main folder:
python setup.py build
python3 setup.py build for a Python 3 build.