superpixel_bbox_subset: Bounding box for a subset of superpixel labels

Description Usage Arguments Details Examples

View source: R/superpixels.R

Description

Bounding box for a subset of superpixel labels

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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))

OpenImageR documentation built on Sept. 10, 2021, 5:08 p.m.