Human visual perception almost always outperforms computer image processing algorithms. For example, your brain easily recognizes a river, whereas a computer may struggle to distinguish rivers from lakes, roads, or sewage treatment plants.
With UAV image data — which often have high spatial resolution but minimal spectral resolution — a shift in analytical thinking is required. Instead of classifying individual pixels, it is more effective to identify meaningful objects or entities. The core principle of Object-Based Image Analysis (OBIA) is therefore: segment first, then classify.
Segmentation is algorithm-dependent and iteratively searches for similarities in spatial, structural, and spectral dimensions to group neighboring pixels into coherent objects. These segments are subsequently classified using supervised training data.
The example below illustrates a typical OBIA classification procedure performed manually in a software environment. The main steps are:
In practice, additional steps are often required due to software constraints. Furthermore, the workflow may not be strictly linear, as intermediate results are frequently reused. The following figure shows the step-by-step process in the form of a graphical model. This can be integrated into QGIS as a tool in the Processing Toolbox.
OBIA Classification Workflow for Orthoimages
For reference, you may Download the base dataset. Additionally, you can download the OBIA workflow as a QGIS Model
. To add it to your QGIS project, click the first icon “Models” in the Processing Toolbox and choose
Add Model to Toolbox
. Note that it runs with fixed default values; to modify it, right-click on the model and choose Edit Model
.
Note:
It is strongly recommended to save the project beforehand (e.g. as obia_test
) to ensure consistent relative paths and avoid path resolution issues later on.
However, OTB does not respect QGIS temporary layers.
In this model, temporary files are stored in the user home directory (~), even if a project is saved.
🛠️ Best practice:
This step-by-step guide demonstrates an OBIA approach using QGIS and the OTB Toolbox. Many segmentation algorithms and classification methods are available. The Mean-Shift segmentation combined with Support Vector Machine (SVM) classification is robust and commonly used.
Key parameters like Range Radius
(feature space) and Spatial Radius
(search space), as well as the Minimum Region Size
, significantly impact the result and often require empirical fine-tuning.
If you’re unfamiliar with digitizing in QGIS, follow this tutorial.
Note: For this example, we will digitize points, not polygons.
Main Menu->Settings->Digitize
and check Reuse last entered attribute values
. This makes it much more convenient to digitize several points for the same class in sequence.
Create a point vector file and digitize the following classes:
class | CLASS_ID |
---|---|
water | 1 |
meadows | 2 |
meadows-rich | 3 |
bare-soil-dry | 4 |
crop | 5 |
green-trees-shrubs | 6 |
dead-wood | 7 |
other | 8 |
Provide at least 10 widely distributed sampling points per class.
Save the file as sample.gpgk
.
Note:
In the QGIS Processing Toolbox, type segmentation and double-click Segmentation
.
Configure the parameters:
example-5.tif
meanshift
25
(adjust based on the pixel scale of your major classes)25
(based on image type and spectral dynamic)25
pixels (small clusters are merged)Vector
8-neighborhood connectivity
200
pixelssegments-meanshift.shp
Click Run
.
Inspect results:
segments-meanshift.shp
into your QGIS project and overlay it on example-5.tif
Layer Properties → Symbology → Simple Fill
:Fill Style: No Brush
and Stroke Color: White
In the Processing Toolbox, type zonalstats
and open ZonalStatistics
(under OTB → Image Manipulation).
example-5.tif
segments-meanshift.shp
segments-meanshift-zonal.shp
Click Run
.
In the Processing Toolbox, search for join and open Join Attributes by Location
.
Set the parameters:
segments-meanshift-zonal.shp
sample.shp
Take Attributes of the first matching feature
Discard records which could not be joined
Fix Geometries
from the Processing Toolbox if needed.
In the Processing Toolbox, type train
and open TrainVectorClassifier
.
Configure:
segments-meanshift-zonal.shp
(after join!)lahn-gi-spann-obia.model
"mean_0 stdev_0 mean_1 stdev_1 mean_3 stdev_3 mean_2 stdev_2"
CLASS_ID
libsvm
linear
csvc
Click Run
.
In the Processing Toolbox, type class
and open VectorClassifier
.
Configure:
segments-meanshift-zonal.shp
lahn-gi-spann-obia.model
CLASS_ID
"mean_0 stdev_0 mean_1 stdev_1 mean_3 stdev_3 mean_2 stdev_2"
lahn-gi-spann-classified_obia.shp
Click Run
.
Finally, load the output vector into QGIS and apply a style:
Layer → Properties → Symbology → Style → Load Style...
You should now see a mostly well-classified result. However, expect some misclassifications as well.
Questions for further reflection: