segmentation_SAGA_SRG: SAGA Seeded Region Growing segmentation algorithm

View source: R/SOptim_SegmentationFunctions.R

segmentation_SAGA_SRGR Documentation

SAGA Seeded Region Growing segmentation algorithm

Description

A function to access SAGA's Seeded Region Growing segmentation algorithm through CLI and optimize some of its parameters using genetic algorithms. The segmentation algorithm has two stages: 1) seed generation and, 2) seeded region growing.

Usage

segmentation_SAGA_SRG(
  x,
  rstList,
  outputSegmRst = NULL,
  Bandwidth = NULL,
  GaussianWeightingBW = NULL,
  VarFeatSpace = NULL,
  VarPosSpace = NULL,
  seedType = 0,
  method1 = 0,
  DWeighting = 3,
  normalize = 0,
  neighbour = 0,
  method2 = 0,
  thresh = 0,
  leafSize = 1024,
  SAGApath = NULL,
  verbose = TRUE
)

Arguments

x

A vector containing the parameters to be optimized by package GA:

  • [1] BAND_WIDTH - bandwidth (cells; default: 10),

  • [2] DW_BANDWIDTH - Gaussian and Exponential Weighting Bandwidth (default: 5) (both for seed generation in stage 1) and,

  • [3] SIG_1 - variance in feature space (default: 1),

  • [4] SIG_2 - variance in position space (default: 1) (both for region growing - stage 2).#'

If you are using this function outside an optimization context it is better to directly define the segmentation parameters in Bandwidth, GaussianWeightingBW, VarFeatSpace and VarPosSpace.

rstList

File paths to the SAGA header files (format: .sgrd) used to perform image segmentation. File names should be provided either by a single string with each file separated by a ';' (e.g. red_band.sgrd;green_band.sgrd;nir_band.sgrd), or a vector of strings with one file name for each element (e.g. resulting from a list.files call).

outputSegmRst

A path to the output segmented image in SAGA .sdat/.srgd format (default: NULL; in this case the segmenter will use the working directory).

Bandwidth

Segmentation bandwidth.

GaussianWeightingBW

Gaussian and Exponential Weighting Bandwidth.

VarFeatSpace

Variance in feature space.

VarPosSpace

Variance in position space.

seedType

Seed type options: [0] minima of variance [1] maxima of variance (default: 0).

method1

Method 1: [0] band width smoothing [1] band width search (default: 0).

DWeighting

Weighting function: [0] no distance weighting [1] inverse distance to a power [2] exponential [3] gaussian weighting (default: 3) - note: only exponential or Gaussian will work! Otherwise it will fail to optimize DW_BANDWIDTH parameter.

normalize

Normalize inputs? [0] No [1] Yes (default: 0).

neighbour

Select the neighbourhood type: [0] 4 connected pixels (von Neumann), [1] 8 connected pixels (Moore) (default is 0).

method2

Method 2: [0] feature space and position [1] feature space (default: 0).

thresh

Similarity threshold (default: 0).

leafSize

Leaf size (for speed optimisation) (default: 1024).

SAGApath

Path to SAGA command-line interface (default: NULL; meaning that PATH env variable is used).

verbose

Output messages? (default: TRUE)

Details

Only accepts SAGA raster file format (problems encontered during segmentation when using other file formats). Only parameters in x will be optimized while the remaining will maintain their default values.

This function uses the following SAGA commands: saga_cmd imagery_segmentation 2 and saga_cmd imagery_segmentation 3. See more info at: http://www.saga-gis.org/saga_tool_doc/3.0.0/imagery_segmentation_2.html http://www.saga-gis.org/saga_tool_doc/3.0.0/imagery_segmentation_3.html http://www.saga-gis.org/saga_tool_doc/

Value

A list object containing output file paths resulting from the segmentation run. (these files will be cleaned after each GA iteration).

References

Adams, R. & Bischof, L. (1994): Seeded Region Growing. IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol.16, No.6, p.641-647.

Bechtel, B., Ringeler, A. & Boehner, J. (2008): Segmentation for Object Extraction of Trees using MATLAB and SAGA. In: Boehner, J., Blaschke, T., Montanarella, L. [Eds.]: SAGA - Seconds Out. Hamburger Beitraege zur Physischen Geographie und Landschaftsoekologie, 19:59-70. download


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