SmallRegionsMerging¶
这个应用程序合并分割结果的小区域。
描述¶
在给定分割结果和原始图像的情况下,它将像素大小小于minSize参数的分段与相邻分段与辐射测量最接近且大小可接受的相邻分段合并。
通过增加大小来处理较小的段:首先,将面积等于1像素的所有段与相邻段合并,然后处理等于2像素的所有段,直到面积最小的段。
参数¶
Input image -in image
Mandatory
The input image, containing initial spectral signatures corresponding to the segmented image (inseg).
Segmented image -inseg image
Mandatory
Segmented image where each pixel value is the unique integer label of the segment it belongs to.
Output Image -out image [dtype]
Mandatory
The output image. The output image is the segmented image where the minimal segments have been merged.
Minimum Segment Size -minsize int
Default value: 50
Minimum Segment Size. If, after the segmentation, a segment is of size strictly lower than this criterion, the segment is merged with the segment that has the closest sepctral signature.
Available RAM (MB) -ram int
Default value: 256
Available memory for processing (in MB).
实例¶
从命令行执行以下操作:
otbcli_SmallRegionsMerging -in smooth.tif -inseg segmentation.tif -out merged.tif -minsize 50
来自Python的评论:
import otbApplication
app = otbApplication.Registry.CreateApplication("SmallRegionsMerging")
app.SetParameterString("in", "smooth.tif")
app.SetParameterString("inseg", "segmentation.tif")
app.SetParameterString("out", "merged.tif")
app.SetParameterInt("minsize", 50)
app.ExecuteAndWriteOutput()