Skip to main content
Version: V2

Segmentation

POST 

/v2/artworks/segmentation

Generate a segmentation mask for an image. Mark the area to segment with a prompt or a set of points, and get back a mask you can use to isolate parts of the image.

Request

Body

required

    imageUrl urirequired

    URL of the image to segment.

    maskExpand integer

    Possible values: >= -16384 and <= 16384

    Default value: 0

    Expands masks by given value.

    maskTaperedCorners boolean

    Applies smoothing to the corners of the masks during expansion.

    maskBlurSigma number

    Possible values: >= 0.1 and <= 100

    Default value: 0.1

    Controls the strength of the blur around the masks.

    maskKernelSize integer

    Possible values: <= 100

    Default value: 0

    Controls the area of the blur around the masks.

    webhook uri

    Optional webhook URL. When provided, the server will POST the final artwork result to this URL upon completion.

    method stringrequired

    Possible values: [text, points]

    Segmentation method: 'text' or 'points'.

    textPrompt string

    Text prompt for object detection. Required when method is 'text'.

    textConfidence number

    Possible values: <= 1

    Default value: 0.2

    Detection confidence threshold (text mode only).

    textMaxDetections integer

    Possible values: >= -1 and <= 100

    Default value: -1

    Max detections, -1 for unlimited (text mode only).

    textCombineMasks boolean

    Default value: true

    Merge all detected masks into one (text mode only).

    pointsPositive

    object

    Positive points marking what to mask (points mode only).

    points array[]

    Possible values: >= 2, <= 2

    List of [x, y] coordinate pairs (0.0 to 1.0).

    labels integer[]

    List of labels corresponding to each point.

    pointsNegative

    object

    Negative points marking what to exclude (points mode only).

    points array[]

    Possible values: >= 2, <= 2

    List of [x, y] coordinate pairs (0.0 to 1.0).

    labels integer[]

    List of labels corresponding to each point.

    pointsRefinementSteps integer

    Possible values: <= 10

    Default value: 0

    Refinement steps for initial mask (points mode only).

    pointsMultimask boolean

    Default value: true

    Generate multiple candidate masks (points mode only).

    pointsBestMask boolean

    Default value: true

    Select only the highest-quality mask (points mode only).

Responses

Response indicating that the segmentation artwork was successfully created.

Schema

    id uuidrequired
    artworkType stringrequired

    Possible values: [segmentation]

    parameters

    object

    required

    imageUrl uri

    URL of the image to segment.

    maskExpand integer

    Possible values: >= -16384 and <= 16384

    Default value: 0

    Expands masks by given value.

    maskTaperedCorners boolean

    Applies smoothing to the corners of the masks during expansion.

    maskBlurSigma number

    Possible values: >= 0.1 and <= 100

    Default value: 0.1

    Controls the strength of the blur around the masks.

    maskKernelSize integer

    Possible values: <= 100

    Default value: 0

    Controls the area of the blur around the masks.

    webhook uri

    Optional webhook URL. When provided, the server will POST the final artwork result to this URL upon completion.

    method string

    Possible values: [text, points]

    Segmentation method: 'text' or 'points'.

    textPrompt string

    Text prompt for object detection. Required when method is 'text'.

    textConfidence number

    Possible values: <= 1

    Default value: 0.2

    Detection confidence threshold (text mode only).

    textMaxDetections integer

    Possible values: >= -1 and <= 100

    Default value: -1

    Max detections, -1 for unlimited (text mode only).

    textCombineMasks boolean

    Default value: true

    Merge all detected masks into one (text mode only).

    pointsPositive

    object

    Positive points marking what to mask (points mode only).

    points array[]

    Possible values: >= 2, <= 2

    List of [x, y] coordinate pairs (0.0 to 1.0).

    labels integer[]

    List of labels corresponding to each point.

    pointsNegative

    object

    Negative points marking what to exclude (points mode only).

    points array[]

    Possible values: >= 2, <= 2

    List of [x, y] coordinate pairs (0.0 to 1.0).

    labels integer[]

    List of labels corresponding to each point.

    pointsRefinementSteps integer

    Possible values: <= 10

    Default value: 0

    Refinement steps for initial mask (points mode only).

    pointsMultimask boolean

    Default value: true

    Generate multiple candidate masks (points mode only).

    pointsBestMask boolean

    Default value: true

    Select only the highest-quality mask (points mode only).

    duration numberrequired
    results string[]required
    status stringrequired

    Possible values: [starting, processing, succeeded, failed, canceled]

    createdAt date-timerequired
Loading...