OBIA on UAV imagery


I would like to perform an OBIA on high resolution UAV imagery (RGBa) of a shallow river, however I am kinda lost on how to get started.

The DN of the A-Band is 255 at each pixel, should i dump it, since it doesn’t contribute important data?

I started with LSMS to get the segmented vector file with mean and var numbers. From that I created the training and validation vectorfiles with the classes I would like to have in the end.

This training and validation vector shapefiles only needs to contain the class_id of the polygons, right? Or does it need to contain the mean and var values of the bands as well?

In my previous workflow I used segmentation (meanshift) instead of LSMS and imported mean and other values from zonal statistics result into my vectorshapefile.
Are mean and var enough or should I always use the data from zonal statistics?

Next step would be “train vector classifier”, and that’s where I got lost. As Input Vector Data I use the training vector shapefile, as validation input data the validation vector shapefile.
I extracted HaralickTexture and LocalStatisticExtraxtion from each band and some vegetation indices.

Do I need to extract texture and other features from each band separately? The resulting raster features contain even more bands, for example the Haralick Texture from red band contains 8 new bands, that would be 24 more bands in total. Or is it enough to extract them from let’s say the red band?

But those are raster data, so I cant import them as feature.
Do I have to compute ImagesStatistics for each feature? And when the answer is yes, how do I merge the different .xml files into one? I just don’t get how to use features :frowning:

Last step would be VectorClassifier.
As input I use the LSMS segmentation vector result and the model file, created from train vector classifier, right? What statistic file do I use as input?

The most important is, how to use features in this process? About what do i need to be carefull?
Thanks for you help :slight_smile:

Configuration setup

My system: Windows10
Version of the OTB: 7.1
I installed the OTB with: download from website
QGIS version: 33.14.16


Thanks for your interest in Orfeo ToolBox.
There are a lot of questions in your message ; I’ll try to answer most !

First of all, I’d like to know what kind of classification you want to achieve on your UAV image ?
The ground resolution is very good, so you can get a lot of details, thanks to the different texture sets OTB can compute. With this kind of image, I think you can at least discriminate water, high vegetation, low vegetation, bare soil, roads, …
But as far as I understand, you don’t have a “Near InfraRed” band, which could be quite useful to discriminate vegetation (thanks to NDVI) or water (with NDWI2 : (NIR-GREEN) / (NIR+GREEN).

If I understand, you want to make a segmentation of your image and then classify its segments in different classes.
What are the classes you want to target, and do you have enough data (ground truth) / labelled samples ?

The main idea to achieve this is :

  1. to use the segmentation framework to obtain a vector file, containing the different segments that cover your input image. The segmentation works in multi-band images, but the “range” parameter may be harder to fix.
  2. get different features (radiometry, textures) from your initial image. To discriminate different classes, it makes sense to use your three color bands, but also compute some textures. The textures don’t need to be computed from all bands. Maybe you could compute a b&w image from your multi-band image and compute textures on that image. For this step, I advise you to make some tests and visualize the resulting layers, to see if some of them are more important.
  3. compute statistics from the images computed at step 2) for the different polygons that you extracted at step 1) : you can use PolygonClassStatistics and give it an image stack (computed with ConcatenateImages) or ZonalStatistics.
  4. prepare learning phase : your training set (validation set is optional, but it’s better to have one) must contain an integer field for the class Id. I think you can start with a Random Forest classifier, which is very versatile and quite easy to configure (k -> nb of clusters = nb of classes you want to discriminate). The TrainVectorClassifier will take your input data (vector files containing all stats of all raster layers), your training set (labelled polygons), optionally a validation set.

This whole pipeline is quite complex, and you can use OTB to achieve this, but maybe for some steps you have to check your data with QGIS. And if you are familiar with Python, you could script all this : it will be easier to manage the different parameters and run different configurations.

Hope that helps, don’t hesitate to ask for more details, and give us more information on the applications you are using.
Best regards,


1 Like

EDIT: I figured it out! TY

Thanks for your detailed reply!

Classes I would like to extract are dry-exposed gravel,submerged vegetation, land vegetation (if possible high/low), bare soil, street and if possible different substrate of the riverbed.
I don’t have a NIR band, but I computed the RGBIVI with which I got good results in discriminating vegetation/not vegetation).
I don’t have any ground truth data, which makes supervised classification of the riverbed substrate an absolute horror. Same with picking the training data for OBIA. The smaller it gets, the harder it is to discriminate with your eyes.

I am kinda in a hurry, I have to finish my thesis until 03.11! I got okay-ish results with unsupervised classification (K-means clustering+reclassification) but would really prefer to at least try out OBIA and show a few results.

I can work with QGIS and SAGA, unfortunately I don’t know much about python.
Wouldn’t it be easier to merge the features and my RGB raster to one raster and then do LargeScaleMeanshift so I don’t have to to step 3?
So what I have is: RGB Main Raster, RGBVI of Main Raster, HarlickTexture with 8 bands, local statistic with 4bands and the hue band of the main raster.

Ok, thanks for the precisions.
It seems very optimistic to extract all these classes from a RVB image and without any ground truth. I’m used to make land-cover classification, but with satellite image times series (ie : Sentinel 2 @ 10 / 20m resolution, but with one image every 5 days, and about 10 bands by image).
For this kind of very detailed image, you have to combine spatial and spectral features

If you merge all features in a multi-band image, I think it will be more difficult to obtain a good segmentation, and the segments you will obtain will be even smaller.
I think you can process the whole pipeline I described by launching the applications separately (from QGIS, or maybe, more easily, with the command line or the graphical interface).

Maybe you could first compute textures from the image, by using the SFSTextureExtraction application. The first layer is the “SFS length” and it may discriminate quite well textured features vs smooth features (you have to fix spatial & spectral threshold).
After that, you can compute statistics on your RVB and RVBIVI bands, and launch the training phase.

Hope that helps a little bit !