Learn R Programming

OpenImageR (version 1.3.0)

superpixel_bbox_subset: Bounding box for a subset of superpixel labels

Description

Bounding box for a subset of superpixel labels

Usage

superpixel_bbox_subset(superpixel_labels, superpixel_subset)

Arguments

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.

Details

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.

Examples

Run this code

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))

Run the code above in your browser using DataLab