slic: Generate superpixel mapping

Description Usage Arguments Value Examples

View source: R/superpixels.R

Description

Performs a variation of kmeans to make virtual pixels.

Usage

1
slic(img, num_superpixel = 200, compactness = 1)

Arguments

img

input image file

num_superpixel

number of superpixels

compactness

parameter that denotes how similarly related the pixels must be

Value

list of 2 images, one with the averaged colors and one with the indexes

Examples

1
2
3
4
5
6
7
x = readImage(system.file('images', 'shapes.png', package='EBImage'))
superpixelated <- slic(x)

# # To display the average color of each superpixel
display(superpixelated[[1]], "raster")
# # To display a colored version that makes evident the superpixel separations
display(EBImage::colorLabels(superpixelated[[2]]), "raster")

jspaezp/clasifierrr documentation built on March 2, 2020, 11:20 a.m.