ConnectedComponentSegmentation

根据用户定义的标准对输入图像进行连通分量分割和基于对象的图像过滤。

描述

这个应用程序允许用户执行掩码、连通分量分割和基于对象的图像过滤。首先,并且可选地,可以基于用户定义的标准来构建掩模,以选择将被分割的图像的像素。然后,根据用户定义的标准执行连通分量分割,以确定两个相邻像素是否属于同一段。在该分割步骤之后,使用另一用户定义的标准对分段属性(例如形状或辐射属性)进行推理,来应用基于对象的图像过滤。判据是由MuParser库(http://muparser.sourceforge.net/).)分析的数学表达式例如,如果两个相邻像素的强度大于95并且它们在第一个图像波段中的值大于80,则表达式“((b1>80)和强度>95)”将把两个相邻像素合并到一个段中。有关可用属性的列表,请参见参数文档。基于对象的图像过滤的输出是矢量化的,并且可以以shapefile或KML格式写入。如果输入图像是原始几何图形,则在写入之前,将使用传感器建模将生成的多边形转换为WGS84,以确保与地理信息系统软件的一致性。为此,可以向应用程序提供数字高程模型。对于大图像,整个处理是在每个平铺的基础上完成的,因此该应用程序可以处理任意大小的图像。

参数

Input Image -in image Mandatory
The image to segment.

Output Shape -out vectorfile Mandatory
The segmentation shape.

Mask expression -mask string
Mask mathematical expression (only if support image is given)

Connected Component Expression -expr string Mandatory
Formula used for connected component segmentation

Minimum Object Size -minsize int Default value: 2
Min object size (area in pixel)

OBIA Expression -obia string
OBIA mathematical expression

高程管理

这组参数允许管理高程值。

DEM directory -elev.dem directory
This parameter allows selecting a directory containing Digital Elevation Model files. Note that this directory should contain only DEM files. Unexpected behaviour might occurs if other images are found in this directory. Input DEM tiles should be in a raster format supported by GDAL.

Geoid File -elev.geoid filename [dtype]
Use a geoid grid to get the height above the ellipsoid in case there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles. A version of the geoid can be found on the OTB website (egm96.grd and egm96.grd.hdr at https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/tree/master/Data/Input/DEM).

Default elevation -elev.default float Default value: 0
This parameter allows setting the default height above ellipsoid when there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles, and no geoid file has been set. This is also used by some application as an average elevation value.


Available RAM (MB) -ram int Default value: 256
Available memory for processing (in MB).

实例

从命令行执行以下操作:

otbcli_ConnectedComponentSegmentation -in ROI_QB_MUL_4.tif -mask "((b1>80)*intensity>95)" -expr "distance<10" -minsize 15 -obia "SHAPE_Elongation>8" -out ConnectedComponentSegmentation.shp

来自Python的评论:

import otbApplication

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

app.SetParameterString("in", "ROI_QB_MUL_4.tif")
app.SetParameterString("mask", "((b1>80)*intensity>95)")
app.SetParameterString("expr", "distance<10")
app.SetParameterInt("minsize", 15)
app.SetParameterString("obia", "SHAPE_Elongation>8")
app.SetParameterString("out", "ConnectedComponentSegmentation.shp")

app.ExecuteAndWriteOutput()

局限性

由于在大图像情况下的平铺方案,一些段可以在多个平铺上任意分割。