# LSMSSmallRegionsMerging

## Brief Description

Third (optional) step of the exact Large-Scale Mean-Shift segmentation workflow.

## Tags

Segmentation,LSMS

## Long Description

This application performs the third step of the exact Large-Scale Mean-Shift segmentation workflow (LSMS). Given a segmentation result (label image) and the original image, it will merge regions whose size in pixels is lower than minsize parameter with the adjacent regions with the adjacent region with closest radiometry and acceptable size. Small regions will be processed by size: first all regions of area, which is equal to 1 pixel will be merged with adjacent region, then all regions of area equal to 2 pixels, until regions of area minsize. For large images one can use the nbtilesx and nbtilesy parameters for tile-wise processing, with the guarantees of identical results.

## Parameters

- [param] -in <string> The input image.. Mandatory: True. Default Value: ""
- [param] -inseg <string> The segmented image input. Segmented image input is the segmentation of the input image.. Mandatory: True. Default Value: ""
- [param] -out <string> The output image. The output image is the input image where the minimal regions have been merged.. Mandatory: True. Default Value: ""
- [param] -minsize <int32> Minimum Region Size. If, after the segmentation, a region is of size lower than this criterion, the region is merged with the "nearest" region (radiometrically).. Mandatory: False. Default Value: "50"
- [param] -tilesizex <int32> Size of tiles along the X-axis.. Mandatory: True. Default Value: "500"
- [param] -tilesizey <int32> Size of tiles along the Y-axis.. Mandatory: True. Default Value: "500"
- [param] -inxml <string> Load otb application from xml file. Mandatory: False. Default Value: ""
- [param] -outxml <string> Save otb application to xml file. Mandatory: False. Default Value: ""

## Limitations

This application is part of the Large-Scale Mean-Shift segmentation workflow (LSMS) and may not be suited for any other purpose.

## Authors

David Youssefi

## See Also

LSMSSegmentation, LSMSVectorization, MeanShiftSmoothing

## Example of use

- in: smooth.tif

- inseg: segmentation.tif

- out: merged.tif

- minsize: 20

- tilesizex: 256

- tilesizey: 256