LSMSVectorization - Exact Large-Scale Mean-Shift segmentation, step 4¶
This application performs the fourth step of the exact Large-Scale Mean-Shift segmentation workflow [1].
Detailed description¶
Given a segmentation result (label image), that may come from the LSMSSegmentation [2] application (out parameter) or have been processed for small regions merging [3] (out parameter), it will convert it to a GIS vector file containing one polygon per segment. Each polygon contains additional fields: mean and variance of each channels from input image (in parameter), segmentation image label, number of pixels in the polygon. For large images one can use the tilesizex and tilesizey parameters for tile-wise processing, with the guarantees of identical results.
Parameters¶
This section describes in details the parameters available for this application. Table [1] presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is LSMSVectorization .
[1] | Table: Parameters table for Exact Large-Scale Mean-Shift segmentation, step 4. |
Parameter Key | Parameter Name | Parameter Type |
---|---|---|
in | Input Image | Input image |
inseg | Segmented image | Input image |
out | Output GIS vector file | Output File name |
tilesizex | Size of tiles in pixel (X-axis) | Int |
tilesizey | Size of tiles in pixel (Y-axis) | Int |
ram | Available RAM (Mb) | Int |
inxml | Load otb application from xml file | XML input parameters file |
outxml | Save otb application to xml file | XML output parameters file |
- Input Image: The input image, containing initial spectral signatures corresponding to the segmented image (inseg).
- Segmented image: Segmented image where each pixel value is the unique integer label of the segment it belongs to.
- Output GIS vector file: The output GIS vector file, representing the vectorized version of the segmented image where the features of the polygons are the radiometric means and variances.
- Size of tiles in pixel (X-axis): Size of tiles along the X-axis for tile-wise processing.
- Size of tiles in pixel (Y-axis): Size of tiles along the Y-axis for tile-wise processing.
- Available RAM (Mb): Available memory for processing (in MB).
- Load otb application from xml file: Load otb application from xml file.
- Save otb application to xml file: Save otb application to xml file.
Example¶
To run this example in command-line, use the following:
otbcli_LSMSVectorization -in maur_rgb.png -inseg merged.tif -out vector.shp -tilesizex 256 -tilesizey 256
To run this example from Python, use the following code snippet:
#!/usr/bin/python
# Import the otb applications package
import otbApplication
# The following line creates an instance of the LSMSVectorization application
LSMSVectorization = otbApplication.Registry.CreateApplication("LSMSVectorization")
# The following lines set all the application parameters:
LSMSVectorization.SetParameterString("in", "maur_rgb.png")
LSMSVectorization.SetParameterString("inseg", "merged.tif")
LSMSVectorization.SetParameterString("out", "vector.shp")
LSMSVectorization.SetParameterInt("tilesizex", 256)
LSMSVectorization.SetParameterInt("tilesizey", 256)
# The following line execute the application
LSMSVectorization.ExecuteAndWriteOutput()
Limitations¶
This application is part of the Large-Scale Mean-Shift segmentation workflow (LSMS) and may not be suited for any other purpose.
Authors¶
This application has been written by David Youssefi.
See Also¶
- These additional resources can be useful for further information:
- [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] LSMSegmentation[3] LSMSmallRegionMerging