Aggregate¶
This application assign a class on each object of a segmentation by majority voting on a pixel-based classification.
Description¶
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.
This application has several output images and supports “multi-writing”. Instead of computing and writing each image independently, the streamed image blocks are written in a synchronous way for each output. The output images will be computed strip by strip, using the available RAM to compute the strip size, and a user defined streaming mode can be specified using the streaming extended filenames (type, mode and value). Note that multi-writing can be disabled using the multi-write extended filename option: &multiwrite=false, in this case the output images will be written one by one. Note that multi-writing is not supported for MPI writers.
Parameters¶
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.
Examples¶
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")
app.ExecuteAndWriteOutput()
Limitations¶
Input classification and labeled image should have identical resolution and footprint