drawRectangles: Plotting function for 2-D object detection visualization.

View source: R/ssdUtilities.R

drawRectanglesR Documentation

Plotting function for 2-D object detection visualization.

Description

Renders boxes on objects within rasterized images.

Usage

drawRectangles(
  image,
  boxes,
  boxColors = "red",
  confidenceValues = NULL,
  captions = NULL
)

Arguments

image

standard image using something like jpeg::readJPEG.

boxes

a data frame or comprising where each row has the format: xmin, xmax, ymin, ymax.

boxColors

Optional scalar or vector of length = numberOfBoxes used for determining the colors of the different boxes.

confidenceValues

Optional vector of length = numberOfBoxes where each element is in the range ⁠[0, 1]⁠. Used for determining border width.

captions

Optional vector of length = numberOfBoxes where each element is the caption rendered with each box.

Author(s)

Tustison NJ

Examples

jpg = ANTsRCore::getANTsRData("r16")
if (requireNamespace("jpeg", quietly = TRUE)) {
image = jpeg::readJPEG(jpg)
vec2d = c(1, 10, 1, 10)
drawRectangles(image, vec2d)
vec2d = rbind(
c(1, 10, 1, 10),
c(20, 40, 30, 40)
)
drawRectangles(image, vec2d)
}

ANTsX/ANTsRNet documentation built on Nov. 21, 2024, 4:07 a.m.