Skip to main content

Module segmentation

Module segmentation 

Source
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§

InstanceMask
A foreground-instance mask plus the number of distinct instances the model identified. Pixel values are 0 for background and 1..=instance_count for each detected instance.
InstanceMaskObservation
A dedicated VNInstanceMaskObservation wrapper.
SegmentationMask
A single grayscale mask in row-major byte order.

Enums§

SegmentationQuality
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 VNInstanceMaskObservation wrapper for the image at path.
generate_person_segmentation_in_path
Generate a person/body silhouette mask for the image at path.