Skip to contents

Get the bounds detected by tem_to_xml() (uses dlib.get_frontal_face_detector()).

Usage

get_bounds(xml, crop = FALSE, subset = NULL)

Arguments

xml

The file path for the XML file created by tem_to_xml()

crop

Whether to crop the image to the bounds

subset

indices of images to subset

Value

A stimlist with a 4-point template of the top-left, top-right, bottom-right, and bottom-left corners of the bounding box, optionally cropped to this box

Examples

xml <- system.file("demo/_images.xml", package = "webmorphR.dlib")
bounds <- get_bounds(xml)
cropped <- get_bounds(xml, crop = TRUE)

if (FALSE) {
  # plot images
  bounds |>
    draw_tem(line.alpha = 1, line.color = "green") |>
    c(cropped) |>
    plot(nrow = 1)
}