Performs segmentation of an image, and output either a raster or a vector file. In vector mode, large input datasets are supported.
This application allows one to perform various segmentation algorithms on a multispectral image.Available
segmentation algorithms are two different versions of Mean-Shift segmentation algorithm (one being
multi-threaded), simple pixel based connected components according to a user-defined criterion, and
watershed from the gradient of the intensity (norm of spectral bands vector). The application has two
different modes that affects the nature of its output.
In raster mode, the output of the application is a classical image of unique labels identifying the segmented
regions. The labeled output can be passed to the ColorMapping application to render regions with
contrasted colours. Please note that this mode loads the whole input image into memory, and as such can
not handle large images.
To segment large data, one can use the vector mode. In this case, the output of the application is a vector file
or database. The input image is split into tiles (whose size can be set using the tilesize parameter), and each
tile is loaded, segmented with the chosen algorithm, vectorized, and written into the output file or database.
This piece-wise behavior ensure that memory will never get overloaded, and that images of any size can be
processed. There are few more options in the vector mode. The simplify option allows simplifying the
geometry (i.e. remove nodes in polygons) according to a user-defined tolerance. The stitch option tries to
stitch together the polygons corresponding to segmented region that may have been split by the tiling
scheme.
This section describes in details the parameters available for this application. Table 4.156, page 811 presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is Segmentation.
Parameter key | Parameter type |
Parameter description |
in | Input image |
Input Image |
filter | Choices |
Segmentation algorithm |
filter meanshift | Choice |
Mean-Shift |
filter cc | Choice |
Connected components |
filter watershed | Choice |
Watershed |
filter mprofiles | Choice |
Morphological profiles based segmentation |
filter.meanshift.spatialr | Int |
Spatial radius |
filter.meanshift.ranger | Float |
Range radius |
filter.meanshift.thres | Float |
Mode convergence threshold |
filter.meanshift.maxiter | Int |
Maximum number of iterations |
filter.meanshift.minsize | Int |
Minimum region size |
filter.cc.expr | String |
Condition |
filter.watershed.threshold | Float |
Depth Threshold |
filter.watershed.level | Float |
Flood Level |
filter.mprofiles.size | Int |
Profile Size |
filter.mprofiles.start | Int |
Initial radius |
filter.mprofiles.step | Int |
Radius step. |
filter.mprofiles.sigma | Float |
Threshold of the final decision rule |
mode | Choices |
Processing mode |
mode vector | Choice |
Tile-based large-scale segmentation with vector output |
|
||
mode raster | Choice |
Standard segmentation with labeled raster output |
mode.vector.out | Output File name |
Output vector file |
mode.vector.outmode | Choices |
Writing mode for the output vector file |
mode.vector.outmode ulco | Choice |
Update output vector file, only allow creating new layers |
mode.vector.outmode ovw | Choice |
Overwrite output vector file if existing. |
mode.vector.outmode ulovw | Choice |
Update output vector file, overwrite existing layer |
mode.vector.outmode ulu | Choice |
Update output vector file, update existing layer |
mode.vector.inmask | Input image |
Mask Image |
mode.vector.neighbor | Boolean |
8-neighbor connectivity |
mode.vector.stitch | Boolean |
Stitch polygons |
mode.vector.minsize | Int |
Minimum object size |
mode.vector.simplify | Float |
Simplify polygons |
mode.vector.layername | String |
Layer name |
mode.vector.fieldname | String |
Geometry index field name |
mode.vector.tilesize | Int |
Tiles size |
mode.vector.startlabel | Int |
Starting geometry index |
mode.vector.ogroptions | String list |
OGR options for layer creation |
mode.raster.out | Output image |
Output labeled image |
inxml | XML input parameters file |
Load otb application from xml file |
outxml | XML output parameters file |
Save otb application to xml file |
|
||
|
||
|
||
|
||
|
||
|
Input Image The input image to segment
Segmentation algorithm Choice of segmentation algorithm (mean-shift by default) Available choices are:
Processing mode Choice of processing mode, either raster or large-scale. Available choices are:
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 1 Example of use with vector mode and watershed segmentationTo run this example in command-line, use the following:
To run this example from Python, use the following code snippet:
Example 2 Example of use with raster mode and mean-shift segmentationTo run this example in command-line, use the following:
To run this example from Python, use the following code snippet:
In raster mode, the application can not handle large input images. Stitching step of vector mode might
become slow with very large input images.
MeanShift filter results depends on the number of threads used.
Watershed and multiscale geodesic morphology segmentation will be performed on the amplitude of the
input image.
This application has been written by OTB-Team.
These additional ressources can be useful for further information: