Reads an image, converts to grayscale, and thresholds to a logical
mask. White-on-black masks (the typical convention) become TRUE
inside the face region and FALSE outside.
Arguments
- path
Path to a PNG or JPEG file. Reading PNG requires the
pngpackage; reading JPEG requiresjpeg(both Suggests).- threshold
Numeric in
[0, 1]. Pixels with grayscale value strictly greater than this areTRUE. Default0.5.- invert
If
TRUE, the mask is inverted (useful for black-on-white masks). DefaultFALSE.
Value
Logical vector of length prod(img_dims), column-major (the
convention face_mask() also uses).
Details
Use this when you have a hand-crafted or anatomically tuned mask and
want to feed it to diagnose_infoval() or infoval() via the mask
argument. For the standard Schmitz 2024 oval, face_mask() is faster
and adds no dependencies.