rhijmans / supercells

The goal of supercells is to utilize the concept of superpixels to a variety of spatial data.

Home Page:https://nowosad.github.io/supercells/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

supercells

R-CMD-check Lifecycle: experimental Codecov test coverage

The goal of supercells is to utilize the concept of superpixels to a variety of spatial data. This package works on spatial data with one variable (e.g., continuous raster), many variables (e.g., RGB rasters), and spatial patterns (e.g., areas in categorical rasters). It is based on the SLIC algorithm (Achanta et al. (2012), doi:10.1109/TPAMI.2012.120), and readapts it to work with arbitrary dissimilarity measures.

Installation

You can install the development version from GitHub with:

install.packages("supercells", repos = "https://nowosad.r-universe.dev")

Example

library(supercells)
library(terra)
#> terra version 1.4.18
library(sf)
#> Linking to GEOS 3.9.2, GDAL 3.3.2, PROJ 8.2.0
vol = rast(system.file("raster/volcano.tif", package = "supercells"))
plot(vol)

vol_slic1 = supercells(vol, k = 50, compactness = 1)
plot(vol)
plot(st_geometry(vol_slic1), add = TRUE, lwd = 0.2)

Documentation

See the package’s vignettes:

  1. Superpixels of a single raster layer
  2. Superpixels of an RGB raster
  3. Superpixels of spatial categorical patterns

Watch the presentations about this package and some related ideas:

  1. Spatial segmentation in R using the supercells package, 2021-09-02, OpenGeoHub Summer School - slides, video
  2. Generalizing the Simple Linear Iterative Clustering (SLIC) superpixels, 2021-09-28, GIScience 2021 - slides, video

Contribution

Contributions to this package are welcome - let us know if you need other distance measures or transformations, have any suggestions, or spotted a bug. The preferred method of contribution is through a GitHub pull request. Feel also free to contact us by creating an issue.

About

The goal of supercells is to utilize the concept of superpixels to a variety of spatial data.

https://nowosad.github.io/supercells/

License:GNU General Public License v3.0


Languages

Language:C++ 51.2%Language:R 48.3%Language:TeX 0.6%