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 3, see this Dockerfile for the commands to install all dependencies on Ubuntu 18.04.
If using Python 2, follow the process here Dockerfile.python2.
The main steps are
- Install OpenCV, NumPy, SciPy using apt-get
- Install python requirements using pip
- Build and Install the Ceres solver from its source using the
Installing dependencies on MacOSX¶
Install OpenCV and the Ceres solver using:
brew install opencv brew install ceres-solver sudo pip install -r requirements.txt
Make sure you update your
PYTHONPATH to include
/usr/local/lib/python2.7/site-packages where OpenCV 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.