Description Usage Arguments Details Value Examples
Create a mask using template points.
1 2 3 4 5 6 7 8 | mask(
stimuli,
mask = "face",
fill = webmorph_options("fill"),
reverse = FALSE,
expand = 1,
tem_id = "FRL"
)
|
stimuli |
list of class stimlist |
mask |
vector of masks or a custom list of template points |
fill |
color to make the mask |
reverse |
if TRUE, the mask covers the listed areas |
expand |
how many pixels to expand the mask |
tem_id |
template ID to pass on to |
For FRL templates, the argument mask
can be a vector with one or more of the following: oval, face, neck, ears (left_ear, right_ear), eyes (left_eye, right_eye), brows (left_brow, right_brow), mouth, teeth, nose.
For Face++ templates (fpp83 or fpp106), the argument mask
can be a vector with one or more of the following: face, eyes (left_eye, right_eye), brows (left_brow, right_brow), mouth, teeth, nose. Because these templates have no forehead points, "face" is usually disappointing.
Set custom masks using the template points (0-based). View an image with labelled templates using plot(stim, pt.plot = TRUE, pt.shape="index")
. Separate points along a line with commas, line segments with semicolons, and mask areas with colons. For example, this would be the custom mask for the eyes in the fpp83 template:
"44,4,56,51,79;79,58,11,25,44:61,67,38,34,40;40,41,17,47,61"
If you set expand = 0, there is sometimes a thin visible line where multiple components of the mask touch.
stimlist with masked images
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | stimuli <- demo_stim()
masked <- mask(stimuli, c("face", "neck", "ears"), "red")
plot(masked)
revmasked <- mask(stimuli, "eyes", "#FFFF00", TRUE) %>%
mask("brows", "purple", TRUE) %>%
mask("nose", "#FF000066", TRUE) %>%
mask("mouth", "blue", TRUE)
plot(revmasked)
masked_fpp <- demo_stim("lisa") %>%
crop_pad() %>%
mask(mask = c("face"), tem_id = "fpp106")
plot(masked_fpp)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.