mask_oval: Apply an oval mask to images

Description Usage Arguments Details Value Examples

View source: R/mask_oval.R

Description

Superimpose an oval mask on a set of images. If the images have templates and bounds = NULL, the maxiumum and minimum x and y coordinates for each image will be calculated (or the overall max and min if each = FALSE) and an oval with those dimensions and position will be placed over the face.

Usage

1
mask_oval(stimuli, bounds = NULL, fill = webmorph_options("fill"), each = TRUE)

Arguments

stimuli

list of class stimlist

bounds

bounds (t, r, b, l) of oval, calculated from templates if NULL

fill

background color for mask

each

whether to calculate a mask for each image (default) or just one

Details

If bounds are set to a list of top, right, bottom and left boundaries, these will be used instead of the boundaries derived from templates.

Value

stimlist with cropped tems and/or images

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
demo_stim() %>% mask_oval(fill = "hotpink") %>% plot()

# remove external points
omask2 <- demo_stim() %>%
  pt_delete(frl_features("halo", "neck", "ears")) %>%
  crop_pad(25) %>%
  mask_oval()

# set bounds manually
omask3 <- demo_stim("lisa") %>%
  mask_oval(bounds = list(t= 50, r = 50, b = 50, l = 50))

facelab/webmorph documentation built on April 11, 2021, 6:34 a.m.