50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


sits (version 1.4.1)

sits_supercells: Segment an image using supercells

Description

Apply a segmentation on a data cube based on the "supercells" package. This is an adaptation and extension to remote sensing data of the SLIC superpixels algorithm proposed by Achanta et al. (2012). See references for more details.

Usage

sits_supercells(
  tile = NULL,
  step = 50,
  compactness = 1,
  iter = 10,
  minarea = 30,
  multicores = 1
)

Value

Set of segments for a single tile

Arguments

tile

Tile, bands, date to be segmented

step

Distance (in number of cells) between initial supercells' centers.

compactness

A compactness value. Larger values cause clusters to be more compact/even (square).

iter

Number of iterations to create the output.

minarea

Specifies the minimal size of a supercell (in cells).

multicores

Number of cores for parallel processing

Author

Gilberto Camara, gilberto.camara@inpe.br

Rolf Simoes, rolf.simoes@inpe.br

Felipe Carvalho, felipe.carvalho@inpe.br

References

Achanta, Radhakrishna, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Süsstrunk. 2012. “SLIC Superpixels Compared to State-of-the-Art Superpixel Methods.” IEEE Transactions on Pattern Analysis and Machine Intelligence 34 (11): 2274–82.

Nowosad, Jakub, and Tomasz F. Stepinski. 2022. “Extended SLIC Superpixels Algorithm for Applications to Non-Imagery Geospatial Rasters.” International Journal of Applied Earth Observation and Geoinformation 112 (August): 102935.

Examples

Run this code
if (sits_run_examples()) {
data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
# create a data cube
cube <- sits_cube(
    source = "BDC",
    collection = "MOD13Q1-6",
    data_dir = data_dir
)

# segment the image
segments <- sits_segment(
    cube = cube,
    tile = "012010",
    bands = "NDVI",
    date = sits_timeline(cube)[1],
    seg_fn = sits_supercells(step = 10)
)
# create a classification model
rfor_model <- sits_train(samples_modis_ndvi, sits_rfor())
# get the average value per segment
samples_seg <- sits_get_data(
    cube = cube,
    samples = segments
)
# classify the segments
seg_class <- sits_classify(
    data = samples_seg,
    ml_model = rfor_model
)
# add a column to the segments by class
sf_seg <- sits_join_segments(
    data = seg_class,
    segments = segments
)
}

Run the code above in your browser using DataLab