# LSMSSegmentation

## Brief Description

Second step of the exact Large-Scale Mean-Shift segmentation workflow.

## Tags

Segmentation,LSMS

## Long Description

This application performs the second step of the exact Large-Scale Mean-Shift segmentation workflow (LSMS). Filtered range image and spatial image should be created with the MeanShiftSmoothing application, with modesearch parameter disabled. If spatial image is not set, the application will only process the range image and spatial radius parameter will not be taken into account. This application will produce a labeled image where neighbor pixels whose range distance is below range radius (and optionally spatial distance below spatial radius) will be grouped together into the same cluster. For large images one can use the nbtilesx and nbtilesy parameters for tile-wise processing, with the guarantees of identical results. Please note that this application will generate a lot of temporary files (as many as the number of tiles), and will therefore require twice the size of the final result in term of disk space. The cleanup option (activated by default) allows removing all temporary file as soon as they are not needed anymore (if cleanup is activated, tmpdir set and tmpdir does not exists before running the application, it will be removed as well during cleanup). The tmpdir option allows defining a directory where to write the temporary files. Please also note that the output image type should be set to uint32 to ensure that there are enough labels available.

## Parameters

- [param] -in <string> The filtered image (cf. Adaptive MeanShift Smoothing application).. Mandatory: True. Default Value: ""
- [param] -inpos <string> The spatial image. Spatial input is the displacement map (output of the Adaptive MeanShift Smoothing application).. Mandatory: False. Default Value: ""
- [param] -out <string> The output image. The output image is the segmentation of the filtered image. It is recommended to set the pixel type to uint32.. Mandatory: True. Default Value: ""
- [param] -spatialr <float> Spatial radius of the neighborhood.. Mandatory: False. Default Value: "5"
- [param] -ranger <float> Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space.. Mandatory: False. Default Value: "15"
- [param] -minsize <int32> Minimum Region Size. If, after the segmentation, a region is of size lower than this criterion, the region is deleted.. Mandatory: False. Default Value: "0"
- [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] -tmpdir <string> This applications need to write temporary files for each tile. This parameter allows choosing the path where to write those files. If disabled, the current path will be used.. Mandatory: False. Default Value: ""
- [param] -cleanup <boolean> If activated, the application will try to clean all temporary files it created. Mandatory: False. Default Value: "True"
- [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

MeanShiftSmoothing, LSMSSmallRegionsMerging, LSMSVectorization

## Example of use

- in: smooth.tif

- inpos: position.tif

- out: segmentation.tif

- spatialr: 5

- ranger: 15

- minsize: 0

- tilesizex: 256

- tilesizey: 256