library(OpenImageR)
#-------------------
# 3-dimensional data
#-------------------
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)
#-------------------
# 2-dimensional data
#-------------------
im_2d = im[,,1]
res_mt = superpixels(input_image = im_2d, method = "slic", superpixel = 200,
compactness = 20, return_slic_data = TRUE)
Run the code above in your browser using DataLab