Preview plot of detections over image using base graphics

ovml_plot(
  img,
  detections,
  line_args = list(col = "blue", lwd = 1),
  label_args = list(col = "white", cex = 0.75)
)

ovml_ggplot(
  img,
  detections,
  line_args = list(col = "blue", size = 0.75, fill = NA),
  label_args = list(col = "white", size = 2.5, fill = "blue"),
  label_geom = "label"
)

Arguments

img

string or image: filename of jpg image, or image as read by [jpeg::readJPEG()]

detections

data.frame: as returned by ovml_yolo_detect()

line_args

list: parameters passed to lines (for ovml_plot()) or [ggplot2::geom_rect()] (for ovml_ggplot())

label_args

list: parameters passed to text

label_geom

string: for ovml_ggplot(), the geom function to use for labels. Either "text" (use [ggplot2::geom_text()]) or "label" ([ggplot2::geom_label()])

Examples


## define some demo data
dets <- data.frame(class = rep("person", 3),
                   score = rep(0.99, 3),
                   xmin = c(829, 611, 736),
                   xmax = c(960, 733, 836),
                   ymin = c(88, 258, 213),
                   ymax = c(278, 444, 385),
                   stringsAsFactors = FALSE)
img <- system.file("extdata/images/2019_03_01-KATS-BEDS-frame.jpg", package = "ovml")
ovml_plot(img, dets, line_args = list(col = "red", lwd = 2))

ovml_ggplot(img, dets) + ggplot2::theme_void()