The Orfeo ToolBox (OTB), an open-source C++ library for remote sensing images processing, is offering a wealth of algorithms to perform Image manipulation, Data pre-processing, Features extraction, Image Segmentation and Classification, Change detection, Hyperspectral processing, and SAR processing.
Since there is no (fresh) RPM package available for Centos or Scientific Linux, here some quick hints (no full tutorial, though) how to get OTB easily locally compiled. We are following the Installation Chapter.
Importantly, you need to have some libraries installed including GDAL. Be sure that it has been compiled with the “–with-rename-internal-libtiff-symbols” and ” –with-rename-internal-libgeotiff-symbols” flags to avoid namespace collision a.k.a segmentation fault of OTB as per “2.2.4 Building your own qualified Gdal“. We’ll configure and build with the GDAL-internal Tiff and Geotiff libraries that supports BigTiff files
# configure GDAL ./configure \ --without-libtool \ --with-geotiff=internal --with-libtiff=internal \ --with-rename-internal-libtiff-symbols=yes \ --with-rename-internal-libgeotiff-symbols=yes \ ... make make install
The compilation of the OTB source code requires “cmake” and some other requirements which you can install via “yum install …”. Be sure to have the following structure for compiling OTB, i.e. store the source code in a subdirectory. The binaries will then be compiled in a “build” directory parallel to the OTB-SRC directory:
OTB-4.4.0/ |-- build/ `-- OTB-SRC/ |-- Applications/ |-- CMake/ |-- CMakeFiles/ |-- Code/ |-- Copyright/ |-- Examples/ |-- Testing/ `-- Utilities/
Now it is time to configure everything for OTB. Since I didn’t want to bother with “ccmake”, below the magic lines to compile and install OTB into its own subdirectory within /usr/local/. We’ll use as many internal libraries as possible according to the table in the installation guide. The best way is to save the following lines as a text script “cmake_otb.sh” for easier (re-)use, then run it:
#!/bin/sh OTBVER=4.4.0 ( mkdir -p build cd build cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/otb-$OTBVER \ -DOTB_USE_EXTERNAL_ITK=OFF -DOTB_USE_EXTERNAL_OSSIM=OFF \ -DOTB_USE_EXTERNAL_EXPAT=OFF -DOTB_USE_EXTERNAL_BOOST=OFF \ -DOTB_USE_EXTERNAL_TINYXML=OFF -DOTB_USE_EXTERNAL_LIBKML=OFF \ -DOTB_USE_EXTERNAL_MUPARSER=OFF \ ../OTB-SRC/ make -j4 # note: we assume to have write permission in /usr/local/otb-$OTBVER make install )
In order to use the freshly compiled OTB, be sure to add the new directories for the binaries and the libraries to your PATH and LD_LIBRARY_PATH variables, e.g. in $HOME/.bashrc:
export PATH=$PATH:/usr/local/bin:/usr/local/otb-4.4.0/bin export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64/:/usr/local/otb-4.4.0/lib/otb/
Enjoy OTB! And thanks to the OTB developers for making it available.