.. _LSMSSmallRegionsMerging: LSMSSmallRegionsMerging ======================= This application is deprecated and will be removed in a future release. This application performs the third (optional) step of the exact Large-Scale Mean-Shift segmentation workflow [1]. Description ----------- Given a segmentation result (can be the out output parameter of the :ref:`LSMSSegmentation` application [2]) and the original image, it will merge segments whose size in pixels is lower than minsize parameter with the adjacent segments with the adjacent segment with closest radiometry and acceptable size. Small segments will be processed by increasing size: first all segments for which area is equal to 1 pixel will be merged with adjacent segments, then all segments of area equal to 2 pixels will be processed, until segments of area minsize. For large images one can use the tilesizex and tilesizey parameters for tile-wise processing, with the guarantees of identical results. The output of this application can be passed to the :ref:`LSMSVectorization` application [3] to complete the LSMS workflow. Parameters ---------- .. contents:: :local: .. |br| raw:: html
.. |em| raw:: html   **Input image** :code:`-in image` *Mandatory* |br| The input image, containing initial spectral signatures corresponding to the segmented image (inseg). **Segmented image** :code:`-inseg image` *Mandatory* |br| Segmented image where each pixel value is the unique integer label of the segment it belongs to. **Output Image** :code:`-out image [dtype]` *Mandatory* |br| 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** :code:`-minsize int` *Default value: 50* |br| 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)** :code:`-tilesizex int` *Default value: 500* |br| Size of tiles along the X-axis for tile-wise processing. **Size of tiles in pixel (Y-axis)** :code:`-tilesizey int` *Default value: 500* |br| Size of tiles along the Y-axis for tile-wise processing. **Available RAM (MB)** :code:`-ram int` *Default value: 256* |br| Available memory for processing (in MB). Examples -------- From the command-line: .. code-block:: bash otbcli_LSMSSmallRegionsMerging -in smooth.tif -inseg segmentation.tif -out merged.tif -minsize 20 -tilesizex 256 -tilesizey 256 From Python: .. code-block:: 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() Limitations ----------- This application is part of the Large-Scale Mean-Shift segmentation workflow (LSMS) and may not be suited for any other purpose. This application is not compatible with in-memory connection since it does its own internal streaming. See also -------- | Alternative: :ref:`SmallRegionsMerging` | [1] Michel, J., Youssefi, D., & Grizonnet, M. (2015). Stable mean-shift algorithm and its application to the segmentation of arbitrarily large remote sensing images. IEEE Transactions on Geoscience and Remote Sensing, 53(2), 952-964. | [2] :ref:`LSMSSegmentation` | [3] :ref:`LSMSVectorization`