Skip to contents

Superimpose an oval mask on a set of images.

Usage

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

Arguments

stimuli

list of stimuli

bounds

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

fill

background color for mask, see color_conv()

each

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

Value

list of stimuli with cropped tems and/or images

Details

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.

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.

See also

Stimulus manipulation functions align(), crop_tem(), crop(), greyscale(), horiz_eyes(), image_func(), mask(), mirror(), pad(), resize(), rotate(), to_size()

Examples

# remove external template points and crop
stimuli <- demo_stim() |> subset_tem(features("face")) |> crop_tem(25)

# three styles of mask
omask1 <- mask_oval(stimuli) |> label("default")
omask2 <- mask_oval(stimuli, each = FALSE) |> label("each = FALSE")
omask3 <- mask_oval(stimuli, bounds = list(t= 50, r = 30, b = 40, l = 30)) |> 
  label("manual bounds")

# visualise masks
c(omask1, omask2, omask3) |> plot(nrow = 2, byrow = FALSE)