R: Segment image into superpixels

slic {lime} | R Documentation

## Segment image into superpixels

### Description

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

### Usage

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

### Arguments

`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.
`n_sp` | The number of superpixels to segment the image into
`weight` | 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.
`n_iter` | The number of iterations to run the algorithm for. The authors suggest 10 and increasing it doesn't add much.

### Value

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

[Package lime version 0.5.1 Index]