Function segment

  • Segment an image into pixel masks.

    Exactly one prompt mode must be set: prompt (text), points, box, or automatic. Returns one SegmentMask per detected region; an empty masks array is a valid (non-error) result.

    Parameters

    Returns Promise<SegmentationResult>

    Throws

    zero or multiple prompt modes.

    Throws

    provider lacks the resolved mode.

    Throws

    provider/network failure or timeout.