extractBoxes {animl}R Documentation

Extract bounding boxes and save as new image from a batch of images

Description

Extract bounding boxes and save as new image from a batch of images

Usage

extractBoxes(
  images,
  min_conf = 0,
  buffer = 0,
  save = FALSE,
  resize = NA,
  outdir = "",
  quality = 0.8,
  parallel = FALSE,
  nproc = parallel::detectCores()
)

Arguments

images

list of MD output or flat data.frame

min_conf

Confidence threshold (defaults to 0, not in use)

buffer

Adds a buffer to the MD bounding box, defaults to 2px

save

Toggle to save output cropped, defaults to FALSE

resize

Size in pixels to resize cropped images, NA if images are not resized, defaults to NA

outdir

Directory in which output cropped images will be saved

quality

Compression level of output cropped image, defaults to 0.8

parallel

Toggle to enable parallel processing, defaults to FALSE

nproc

Number of workers if parallel = TRUE, defaults to output of detectCores()

Details

A variable crop_rel_path in the image list or data.frame can be used to change the path where the crops will be stored.

The final output path will be the outdir plus the crop_rel_path.

Value

a flattened dataframe containing crop information

Examples

## Not run: 
images <- read_exif(imagedir, tags = c("filename", "directory"), recursive = TRUE)
crops <- extractAllBoxes(images,save=TRUE,out)

## End(Not run)

[Package animl version 1.1.0 Index]