Compiling OTB SuperBuild with Monteverdi and Remote Modules (Ubuntu 16.04)

23 November 2016 0

Orfeo ToolBox (OTB) is an amazing tool for remote sensing. Some modules are not included in the distribution because they are produced by external users, but some of them are really interesting.

For example there is the mosaik tool for gathering many images with color harmonization. Another one is the Fast Forward Features Selection to keep best features and avoid too many features.

The basics of the compilation is taken form the OTB Software Guide

Get data from git

First, you need to create your Qgis folder and to clone develop OTB git

mkdir ~/OTB  
cd ~/OTB  
git clone  
mkdir build  
mkdir install
cd ~/OTB/otb  
git checkout develop

Setup parameters and install the SuperBuild

Go into the build folder, then choose which library you want. On the cmake line below almost libraries are installed so there’s no problem with remote modules later. If you want to install Shark library, just add -D CMAKE_CXX_FLAGS=–std=gnu++11 for forcing using C++11.

cd ~/OTB/build

TIPS : If you have a multi-core processor, you can add “-j 4” after “make” for using 4 cores :

make -j 4

Compile modules

Now you need to compile module which are not in the SuperBuild.

Check remote modules from OTB

Check remote modules from OTB and clic on Generate

Open CMakeCache.txt (in~/OTB/build/OTB/build) with cmake-gui, and check all Module_XXX (or only check those you want).
Temporary Gap Filling and maybe some other remote modules need to have c++ 11 compiler, so force with CMAKE_CXX_FLAGS with gnu++11 :

cd ~/OTB/build/OTB/build/
cmake -DCMAKE_CXX_FLAGS=--std=gnu++11 ~/OTB/otb
make install

Finish setup

Add path for Monteverdi and for OTB app to your .profile to access to OTB apps and to Monteverdi (copy/paste all lines at once):

echo "
OTB_APPLICATION_PATH=~/OTB/build/OTB/build/lib/otb/applications" >> ~/.profile

Then, just check eveything is ok, type on a terminal :


Enjoy !