User Tools

Site Tools


W08-1: Segmentation

In order to prepare the next round of sampling training sites, this worksheet covers the image segmentation. The segments can subsequently be used for object-oriented classification or for the (better?) sampling of training sites.

After completing this worksheet you should be able to perform some image segmentation using a multi-step workflow.

Things you need for this worksheet

  • GIS — most commercial or open source GIS systems will be fine. For open source software running on Ubuntu Linux, the Ubuntu GIS package is a good choice. For Windows, it will be a good choice installing everything via the OSGeo4W environment and not individually. Actually both repositories make available a comprehensive bundle of GI -tools and software packages. We will focus on GRASS, QGIS and SAGA. On the commercial side, ArcGIS is one of the powerful options.

  • OTB — The Orfeo ToolBox is a quite handy open source suite for remote sensing tasks. While it can directly be used through a programming API e.g. using Python, it can also be integrated into QGis (processing plugin has to be installed) or run as a stand alone GUI called Monteverdi2. Please refer to the actual download options to select the installation of your choice.

  • satelliteTools for functions which call required OTB routines from within R
  • Scaled PCA covering Marburg University forest and derived from RGB as well as four vegetation indices available from

    GeoMOC - a data repository holding various data sets for visualization and download.

Image segmentation

The major problem of image segmentation is generally related to the question which spatial and spectral range to choose in order to retrieve an appropriate generalization of image features (i.e. segments). Another thing is that if different e.g. bands are used, scaling becomes an issue since - in general - the spectral range can only be defined globally for the entire dataset.

In the following, you should follow the approach from the OTB's exact large-scale mean-shift segmentation approach, a four step procedure which is described here (step 1) and from here onward (step 2 to 4).

Learning log assignments

8-) As always, please add these entries to your today's learning log in the beginning of your Rmd file you will use to push to your GitHub classroom.

  • Favorite aspect of the session (if any)
  • Superfluous aspect of the session (if any)
  • Eureka effect (if any)
  • Links to what I've learned so far (if any)
  • Questions (if any)

As today's special, please complete the following assignment:

:-\ Please compute an image segmentation on the above dataset following OTB's cookbook procedure. The segmentation should generalize the features reasonably well. Since some iteration is required, you should call the respective OTB routines from an R script. To ease things a little, you can use the respective functions from the satelliteTools package provided above (see tip below). In order to minimize computational efforts to a certain degree, it is sufficient if you use

  1. a spatial range of 5 m and a spectral range of 15 in the first step
  2. a spatial range of 1 m and a spectral range of 15 and 30 in the second step
  3. a minimum size of 40, 50, 60, and 70 in the third step

:-\ Please have a look at the different output files and decide which one might work best for your upcoming task (selecting training sites, maybe aggregating image classification results).

:-\ Please update (i.e. commit) your R script publish (i.e. push) it to the GitHub classroom.

Installation of R packages from GitHub

If you want to install a package directly from GitHub, type:


For example: devtools::install_github(“environmentalinformatics-marburg/satelliteTools”)


There is a bug in OTB version 5.0 (i.e. the one currently available via OSGeo4W). Therefore, download the latest OTB release, extract it in a folder of your choice and call the satelliteTools::initOTB function with the path to the “bin” folder within the extracted OTB folder.

courses/msc/msc-phygeo-remote-sensing/worksheets/rs-ws-08-1.txt · Last modified: 2017/01/13 21:26 by tnauss