R has the capacity for image segmentation, although all of the examples I have come across utilize a single band for the segmentation (example). I am interested in combining R's capacity for random forest image classification with an object-oriented segmentation approach.

What functionality does R have for multispectral image segmentation that is suitable for natural resources-based analysis? Or how to link the results of a single band segmentation for further analysis.

  • 5
    In the example you link, they use spectral clustering. Spectral clustering in principle can be applied to n-dimensional data as well, as it simply decomposes a similarity matrix that can be built for any type of data. The principle of spectral clustering is to embed data in a lower dimensional space and perform clustering in that space (e.g. with kmeans). I'm not very familiar with R, but I'm sure it would only take few lines of code (at least in matlab, it does take few lines). If not, I'm sure there are free implementations of other approaches, such as mean-shift segmentation.
    – pixelmitch
    Commented Jan 28, 2015 at 11:23
  • If it doesn't have to be R (just something open source) you could use RSGISLib for the segmentation and apply Random Forests using scikit-learn. There is an example I wrote on how to do this here. spectraldifferences.wordpress.com/2014/09/07/…. You could also use RSGISLib to segment and attribute objects then import into R as a text file for the classification.
    – danclewley
    Commented May 18, 2016 at 7:15
  • Did you find an answer?
    – Ka_Papa
    Commented Apr 17, 2018 at 9:30
  • @GeorgeNostradamos Not for R. However, Python has a mean shift segmentation that utilizes multiple bands. I believe that is in the scikit-learn package.
    – Aaron
    Commented Apr 17, 2018 at 13:56
  • @Aaron I already have experience with python and GRASS but I wanted to see how far I can push R. Anyway I'll see what I can find, thanks
    – Ka_Papa
    Commented Apr 17, 2018 at 15:07

1 Answer 1


This may be easier using the Orfeo toolbox (https://www.orfeo-toolbox.org/), this is provided with OSgeo4W and can be accessed usign QGIS or a command line interface.

This tutorial uses mean shift segmentaion to generate objects, which can be the classified using SVM/random forests etc.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.