Learn R Programming

OpenImageR (version 1.1.4)

superpixels: SLIC and SLICO superpixel implementations

Description

SLIC and SLICO superpixel implementations

Usage

superpixels(input_image, method = "slic", superpixel = 200,
  compactness = 20, return_slic_data = FALSE,
  return_lab_data = FALSE, return_labels = FALSE, write_slic = "",
  verbose = FALSE)

Arguments

input_image

a 3-dimensional input image (the range of the pixel values should be preferably in the range 0 to 255)

method

a character string specifying the method to use. Either "slic" or "slico"

superpixel

a numeric value specifying the number of superpixels to use

compactness

a numeric value specifying the compactness parameter. The compactness parameter is needed only if method is "slic". The "slico" method adaptively chooses the compactness parameter for each superpixel differently.

return_slic_data

a boolean. If TRUE then the resulted slic or slico data will be returned

return_lab_data

a boolean. If TRUE then the Lab data will be returned

return_labels

a boolean. If TRUE then the labels will be returned

write_slic

a character string. If not an empty string ("") then it should be a path to the output file with extension .bin ( for instance "/my_dir/output.bin" ). The data will be saved in binary format.

verbose

a boolean. If TRUE then information will be printed in the R session

Details

The input_image can take images of any type as long as they are 3-dimensional. In case that a .tif file has less than 3-image-bands the user can convert the image to 3-dimensional using the List_2_Array () function.

References

https://ivrl.epfl.ch/research-2/research-current/research-superpixels

Examples

Run this code
# NOT RUN {
library(OpenImageR)

path = system.file("tmp_images", "slic_im.png", package = "OpenImageR")

im = readImage(path)

res = superpixels(input_image = im, method = "slic", superpixel = 200, 

                  compactness = 20, return_slic_data = TRUE)

# }

Run the code above in your browser using DataLab