Available on crate feature
segmentation only.Expand description
Segmentation mask generation —
VNGeneratePersonSegmentationRequest and
VNGenerateForegroundInstanceMaskRequest.
Both produce a grayscale CVPixelBuffer mask; this module copies
it into a Rust-owned Vec<u8> so callers don’t need a CoreVideo
dependency. Mask values are 8-bit (0 = background, 255 =
foreground). For instance masks, pixel values index into a list
of detected instances (1..=instance_count).
Structs§
- Instance
Mask - A foreground-instance mask plus the number of distinct instances
the model identified. Pixel values are
0for background and1..=instance_countfor each detected instance. - Instance
Mask Observation - A dedicated
VNInstanceMaskObservationwrapper. - Segmentation
Mask - A single grayscale mask in row-major byte order.
Enums§
- Segmentation
Quality - Apple person-segmentation quality.
Functions§
- generate_
foreground_ instance_ mask_ in_ path - Generate an instance segmentation mask of all foreground objects
in the image at
path(macOS 14+). - generate_
foreground_ instance_ mask_ observation_ in_ path - Generate a dedicated
VNInstanceMaskObservationwrapper for the image atpath. - generate_
person_ segmentation_ in_ path - Generate a person/body silhouette mask for the image at
path.