extractBoxesFromMD {animl}R Documentation

Extract bounding boxes for a single image and save as new images

Description

Requires the unflattened raw MD output

Usage

extractBoxesFromMD(
  image,
  min_conf = 0,
  buffer = 0,
  return.crops = FALSE,
  save = FALSE,
  resize = NA,
  outdir = "",
  quality = 0.8
)

Arguments

image

single image, raw MD output format (list)

min_conf

Confidence threshold (defaults to 0, not in use)

buffer

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

return.crops

Toggle to return list of cropped images, defaults to FALSE

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

Details

A variable crop_rel_path in the image list 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 data.frame containing crop information

Examples

## Not run: 
images <- read_exif(imagedir, tags = c("filename","directory"), recursive = TRUE)
crops <- extractBoxesFromMD(images[1, ], return.crops = TRUE, save = TRUE)

## End(Not run)

[Package animl version 1.1.0 Index]