segmentation_OTB_LSMS: Large Scale Mean Shift segmentation algorithm from Orfeo...

View source: R/SOptim_SegmentationFunctions.R

segmentation_OTB_LSMSR Documentation

Large Scale Mean Shift segmentation algorithm from Orfeo Toolbox (OTB)

Description

A function providing CLI access to OTB's LSMS segmentation and optimize its parameters using genetic algorithms. This function uses the same values for the spectral and spatial range parameters in the mean-shift smoothing and large-scale segmentation step. If you wish to use different values in each step use function segmentation_OTB_LSMS2.

Usage

segmentation_OTB_LSMS(
  x,
  inputRstPath,
  outputSegmRst = NULL,
  SpectralRange = NULL,
  SpatialRange = NULL,
  MinSize = NULL,
  lsms_maxiter = 10,
  tilesizex = 2500,
  tilesizey = 2500,
  otbBinPath = NULL,
  RAM = 3072,
  verbose = TRUE
)

Arguments

x

A vector of size three containing the parameters that will be optimized by the genetic algorithms from package GA:

  • [1] Range radius defining the radius (expressed in radiometry units) in the multi-spectral space (float);

  • [2] Spatial radius of the neighborhood (float);

  • [3] Minimum segment/region size. If, after the segmentation, a region is of size lower than this criterion, the region is merged with the "nearest" region (radiometrically) (integer).

If you are using this function outside an optimization context it is better to directly define the segmentation parameters in SpectralRange, SpatialRange and MinSize.

inputRstPath

The input raster dataset used to perform the image segmentation using OTB LSMS algorithm (typically a multi-layered raster dataset with segmentation features in each band).

outputSegmRst

A path to the output segmented image (default: NULL; in this case the segmenter will internally determine a temporary output folder and file path inside the working directory).

SpectralRange

Range radius defining the radius (expressed in radiometry units) in the multi-spectral space (float).

SpatialRange

Spatial radius of the neighborhood (float).

MinSize

Minimum segment/region size.

lsms_maxiter

Algorithm iterative scheme will stop if convergence hasn't been reached after the maximum number of iterations (integer).

tilesizex

Size of tiles along the X-axis (integer).

tilesizey

Size of tiles along the Y-axis (integer).

otbBinPath

The system path to OTB binaries (e.g., where otbcli_MeanShiftSmoothing is located). By default this is equal to NULL which means that the system path is used.

RAM

Available memory for processing the image data (in MB).

verbose

Print output messages (default: TRUE).

Value

A list object containing output file paths resulting from the segmentation run. These files will be cleaned after each GA iteration or if an error occurs. Also, notice that some auxiliary files will be created: otb_filt_range_, otb_filt_spatial_, otb_segm_init_.

Note

Changed system() option to show.output.on.console = TRUE to avoid for errors happening on windows-10...

Check [OTB documentation](https://www.orfeo-toolbox.org/CookBook/Applications/app_LargeScaleMeanShift.html) for more info.

References

J. Michel, D. Youssefi and M. Grizonnet, 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.


joaofgoncalves/SegOptim documentation built on Feb. 5, 2024, 11:10 p.m.