Package description

SegOptim is a R package for performing object-based image analysis (OBIA). It allows to run, compare and optimize multiple image segmentation algorithms in the context of supervised classification. It also allows to perform unsupervised classification with several different methods and to compare them through internal clustering metrics.

It's really simple to install! Just run the following line of R code:


[NOTE] When installing the latest version from BitBucket, the package will be substantially larger compared to CRAN simply because test data (used for running testthat checks) is also included.

For more details about installation and how to use the package go to the tutorial here.

Check also the paper describing the package functionalities here.

For sorting out technical issues, contact us through the dedicated Google group here.


Currently the package offers several functionalities, namely:

  • Run different image segmentation algorithms;

  • Populate image segments with aggregate statistics (using pre- and/or user-defined functions;

  • Perform object-based supervised classification with several different methods;

  • Evaluate classification performance for single- or multi-class problems;

  • Optimize image segmentation parameters using Genetic Algorithms (GA) and other methods;

  • Compare different algorithms based on optimized solutions;

  • Perform unsupervised classification with several methods and compare the results using internal clustering criteria.

Available algorithms

Image segmentation algorithms

SegOptim allows comparing multiple algorithms both for image segmentation, supervised and unsupervised classification.

Currently, the following methods are available for image segmentation:

  • ArcGIS Mean-shift (link);

  • GRASS GIS Region Growing (link);

  • Orfeo ToolBox (OTB) Large-scale Mean-shift (link);

  • RSGISLib Shepherd's k-means (link);

  • SAGA GIS Seeded Region Growing (link).

  • TerraLib 5 Baatz-Schape Multi-resolution segmentation and Mean Region Growing (link)

Supervised classification algorithms

As for supervised classification, the following methods are available through R:

  • Flexible Discriminant Analysis (FDA) (link);

  • Generalized Boosted Model (GBM) (link);

  • K-nearest neighbor classifier (KNN) (link);

  • Random Forest (RF) (link);

  • Support Vector Machines (SVM) (link).

Unsupervised classification algorithms

Regarding unsupervised classification, SegOptim supports the following algorithms:

  • CLARA (Clustering LARge Applications) (link)

  • Hard competitive learning algorithm (link)

  • K-means (link)

  • Neural gas algorithm (link)

The support for (internal) clustering criteria used for comparing each unsupervised solution is given by the clusterCrit package (link).


Currently, SegOptim has several limitations that derive from design decisions that were made during development stages and, to be completely honest, the fact that we are not software developers... (sorry for that ;-). Among other, these limitations are:

  • Memory restrictions (especially for large images);

  • Computational complexity and workload (especially for applying optimization);

  • No pre-processing for satellite data;

  • Only allows single-stage classification;

  • It does not allow to explore hierarchical or spatial relations among or between objects;

  • No post-classification processing;

  • Although tests have been successfully accomplished in several operating systems, Windows is for now the most supported one.

We are planning to add new features and to address some of these limitations in future releases however this is the status quo! ;-)



  • Corrects a couple of bugs

  • Adds the possibility to define available RAM in OTB segmentation