Skip to contents

This function takes an image and augments it by rotating it multiple times.

Usage

image_augment(
  img,
  pattern = NULL,
  times = 12,
  type = "export",
  dir_original = NULL,
  dir_processed = NULL,
  parallel = FALSE,
  verbose = TRUE
)

Arguments

img

An Image object.

pattern

A regular expression pattern to select multiple images from a directory.

times

The number of times to rotate the image.

type

The type of output: "export" to save images or "return" to return a list of augmented images.

dir_original

The directory where original images are located.

dir_processed

The directory where processed images will be saved.

parallel

Whether to perform image augmentation in parallel.

verbose

Whether to display progress messages.

Value

If type is "export," augmented images are saved. If type is "return," a list of augmented images is returned.

Examples

if (interactive() && requireNamespace("EBImage")) {
library(pliman)
img <- image_pliman("sev_leaf.jpg")
imgs <- image_augment(img, type = "return", times = 4)
image_combine(imgs)
}