LSMSSmallRegionsMerging¶
此应用程序已弃用,并将在未来版本中删除。
此应用程序执行大规模均值漂移分段工作流的第三步(可选 [1] 。
描述¶
给定的分割结果(可以是 LSMSSegmentation 应用程序 [2] )和原始图像,它将把以像素为单位的大小小于minSize参数的段与相邻段与具有最接近辐射测量和可接受大小的相邻段合并。
通过增加大小来处理较小的段:首先,将面积等于1像素的所有段与相邻段合并,然后处理等于2像素的所有段,直到面积最小的段。对于较大的图像,可以使用tilesizex和tilesizey参数进行平铺处理,并保证得到相同的结果。
此应用程序的输出可以传递给 LSMSVectorization 应用程序 [3] 以完成LSM工作流程。
参数¶
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. An ecoding of uint32 is advised.
Minimum Segment Size -minsize int
Default value: 50
Minimum Segment Size. If, after the segmentation, a segment is of size lower than this criterion, the segment is merged with the segment that has the closest sepctral signature.
Size of tiles in pixel (X-axis) -tilesizex int
Default value: 500
Size of tiles along the X-axis for tile-wise processing.
Size of tiles in pixel (Y-axis) -tilesizey int
Default value: 500
Size of tiles along the Y-axis for tile-wise processing.
Available RAM (MB) -ram int
Default value: 256
Available memory for processing (in MB).
实例¶
从命令行执行以下操作:
otbcli_LSMSSmallRegionsMerging -in smooth.tif -inseg segmentation.tif -out merged.tif -minsize 20 -tilesizex 256 -tilesizey 256
来自Python的评论:
import otbApplication
app = otbApplication.Registry.CreateApplication("LSMSSmallRegionsMerging")
app.SetParameterString("in", "smooth.tif")
app.SetParameterString("inseg", "segmentation.tif")
app.SetParameterString("out", "merged.tif")
app.SetParameterInt("minsize", 20)
app.SetParameterInt("tilesizex", 256)
app.SetParameterInt("tilesizey", 256)
app.ExecuteAndWriteOutput()
局限性¶
此应用程序是大规模Mean-Shift分段工作流程(LSM)的一部分,可能不适用于任何其他目的。此应用程序与内存中连接不兼容,因为它执行自己的内部流。