This application assign a class on each object of a segmentation by majority voting on a pixel-based classification.


The aim of this application is to merge the result of a segmentation with a pixel-based image classification in order to produce an object-oriented image classification. The input segmentation is a labeled image, typically the result provided by the OTB application LSMSSegmentation. The output is a vector dataset containing objects and the corresponding class in the attribute table. Connected regions belonging to the same class are merged. This application could be used at the last step of the LSMS pipeline in replacement of the application LSMSVectorization.


Input classification -in image Mandatory
Pixel-based image classification.

Labeled image -inseg image Mandatory
Labeled image representing a segmentation of an image.

Output raster -outim image [dtype] Mandatory
Output raster, object-oriented image classification.

Output vector dataset -out filename [dtype] Mandatory
Output vector dataset, object-oriented image classification. The class 0 is considered as background.


From the command-line:

otbcli_Aggregate -in classification.tif -inseg labeled_image.tif -outim image_classification.tif -out vector_classification.shp

From Python:

import otbApplication

app = otbApplication.Registry.CreateApplication("Aggregate")

app.SetParameterString("in", "classification.tif")
app.SetParameterString("inseg", "labeled_image.tif")
app.SetParameterString("outim", "image_classification.tif")
app.SetParameterString("out", "vector_classification.shp")



Input classification and labeled image should have identical resolution and footprint