superpixel_bbox_subset | R Documentation |
Bounding box for a subset of superpixel labels
superpixel_bbox_subset(superpixel_labels, superpixel_subset)
superpixel_labels |
a matrix. The superpixel_labels parameter corresponds to the output labels of the superpixels function |
superpixel_subset |
a numeric or integer vector specifying the subset of superpixel segments. |
This function should be utilized to return the bounding box for a subset of superpixel segments. To compute the bounding box for all superpixels use the superpixel_bbox function.
library(OpenImageR)
#-----------
# read image
#-----------
path = system.file("tmp_images", "slic_im.png", package = "OpenImageR")
im = readImage(path)
im = im[,, 1:3]
#--------------------
# compute superpixels
#--------------------
res = superpixels(input_image = im, method = "slic", superpixel = 200,
compactness = 20, return_labels = TRUE)
#-------------------------
# compute the bounding box ( for subset of superpixels )
#-------------------------
bbox = superpixel_bbox_subset(res$labels, superpixel_subset = c(0, 10, 30))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.