OTB development on Linux

From OTBWiki
Revision as of 12:50, 23 May 2016 by Poughv (Talk | contribs) (Configure OTB)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Setting up a development environment on Linux is very easy now. This wiki page is written based on OTB 5.4.0 release but the steps below apply to all version since 5.4.0.

Make sure you have the below packages installed in your system.

Prerequisites

  • cmake 3.0 or higher
  • gcc 4.6 or higher
  • OTB XDK (5.4.0 or higher)
  • git (optional, if you are using source archives from orfeotoolbox.org/packages/

Optionally

  • any IDE(emacs, vim, CodeBlocks, KDevelop, Eclipse) [optional]

Extract XDK

cd /opt
wget https://www.orfeo-toolbox.org/packages/xdk/OTB-5.4/OTB-5.4.0-xdk-Linux64.run
chmod +x OTB-5.4.0-xdk-Linux64.run
./OTB-5.4.0-xdk-Linux64.run

You now will have a directory /opt/OTB-5.4.0-xdk-Linux64

Configure OTB

mkdir -p /opt/OTB/build && cd /opt/OTB
git clone --depth=1 --branch=develop https://git@git.orfeo-toolbox.org/git/otb.git source

Tip: Anonymous fast checkout using --depth and --branch

Enable OTB_USE_*

By default, all OTB_USE_* variables in OTB are unchecked except for 6S and SiftFast. This is discussed in otb-developers thread in May 2015.

You can check/activate them in your cmake-gui/ccmake. Possible options that can be activated when using XDK are listed below.

OTB_USE_CRUL 
OTB_USE_MUPARSER 
OTB_USE_MUPARSERX
OTB_USE_OPENCV
OTB_USE_LIBKML
OTB_USE_SIFTFAST

Attention: Below cmake options are not tested. You can activate them if you need.

OTB_WRAP_PYTHON  (untested. If you have python installed on your system. You can test this. But let us know if that works!)
OTB_WRAP_JAVA    (same reason as python)
OTB_USE_OPENJPEG (must be OFF. openjpeg is processed via gdal openjpeg driver. The XDK version of gdal has this driver enabled)
OTB_USE_MAPNIK   (must be OFF. development files not distributed with XDK)

Build

cd /opt/OTB/build
cmake /opt/OTB/source -DCMAKE_PREFIX_PATH=/opt/OTB-5.4.0-xdk-Linux64
make && make install

Tip: Set make -jN where N is the number of cores to speed up your build

Tip: You can also set CMAKE_PREFIX_PATH environment varible using export CMAKE_PREFIX_PATH=/opt/OTB-5.4.0-xdk-Linux64 and run cmake /opt/OTB/source

References

develop/.travis.yml

develop/Utilities/Maintenance/TravisBuild.sh

develop/Utilities/Maintenance/TravisBuild.cmake