slic: Segment image into superpixels

Description Usage Arguments Value

View source: R/RcppExports.R


This is an implementation of the SLIC superpixel algorithm for segmenting images into connected similar patches. It is used by lime for permuting image input but exported so that others might use it for other things


slic(L, a, b, n_sp, weight, n_iter)


L, a, b

Raw matrices giving the L, a, and b component of each pixel in the image to segment. The dimensions of all matrices must match.


The number of superpixels to segment the image into


A numeric giving the tradeoff between spatial and colour distance. Higher values give more compact and heterogeneous superpixels, while lower values will give superpixels of more irregular shape but with a more homogeneous colour. Good values to start with is 10-20.


The number of iterations to run the algorithm for. The authors suggest 10 and increasing it doesn't add much.


An integer matrix of the same dimensions as L, a, and b, indexing each pixel into its corresponding superpixel

lime documentation built on Feb. 24, 2021, 5:08 p.m.