View source: R/SOptim_SegmentationFunctions.R
segmentation_GRASS_RG | R Documentation |
A function providing CLI access to GRASS Region Growing image segmentation algorithm
and optimize parameters using genetic algorithms. To use this function, image features used in
segmentation must be imported into a GRASS database (importToGRASS
).
segmentation_GRASS_RG(
x,
GRASS.path = "grass",
GRASS.inputRstName,
GRASS.GISDBASE,
GRASS.LOCATION_NAME = "demolocation",
GRASS.MAPSET = "PERMANENT",
outputSegmRst = NULL,
Threshold = NULL,
MinSize = NULL,
memory = 1024,
iterations = 20,
verbose = TRUE
)
x |
A vector with size two defining the values of segmentation parameters optimized by GA:
If you are using this function outside an optimization context it is better to directly define the
segmentation parameters in |
GRASS.path |
Defines the initialization path to GRASS .bat file for windows (for example: 'C:/GRASS/grass70') or the .sh or .py file for Linux (usually this should be set to '/usr/bin/grass'). The default is "grass70" which assumes that GRASS is in the path environmental variables and version 7.0.x (which may not be appropriate in most cases and therefore this parameter should be set explicitly). |
GRASS.inputRstName |
Name of the raster dataset that will be segmented (typically a multi-layered raster dataset with segmentation features in each band). |
GRASS.GISDBASE |
Name of GRASS GIS database. |
GRASS.LOCATION_NAME |
Name of GRASS location name (default: "demolocation"). |
GRASS.MAPSET |
Name of GRASS mapset (default: "PERMANENT"). |
outputSegmRst |
A path to the output segmented image exported by GRASS |
Threshold |
Difference threshold between 0 and 1. Threshold: 0 merges only identical segments; threshold: 1 merges all |
MinSize |
Minimum number of cells in a segment (integer) - the final step will merge small segments with their best neighbor |
memory |
Memory used to run i.segment (default: 1024Mb). |
iterations |
Maximum number of iterations (default: 20). |
verbose |
Output messages? (default: TRUE) |
This function uses a batch file defining the batch job (GRASS_BATCH_JOB) and starts GRASS with the
appropriate parametrization. The i.segment
command is used to run the segmentation.
The similarity calculation method uses the default value ("euclidean").
See more info at GRASS manual pages online:
i.segment
at https://grass.osgeo.org/grass72/manuals/i.segment.html
Access to GRASS GIS manuals https://grass.osgeo.org/documentation/manuals/
A list object containing output file paths resulting from the segmentation run. These files will be cleaned after each GA iteration.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.