Image Segmentation
studio-segmentDetect and segment objects in images. Auto mode finds all objects; prompt mode targets specific objects via points or bounding box.
In auto mode, the service finds every object in the image, filters out tiny and low-confidence masks, and returns up to 100 segments sorted by area. In prompt mode, it predicts masks from the points or bounding box you provide and returns up to 3 candidates ranked by confidence. All masks are returned in COCO RLE format.
Segment Image
/v1/proxy/studio-segmentDetect and segment objects (sync)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
imageUrl | string | required | Public URL of the image |
mode | string | optional | 'auto' (default) — find all objects. 'prompt' — target specific object via points/box. |
region | object | optional | Auto mode. Crop region: {x, y, width, height}. |
points | array | optional | Prompt mode. [{x, y, label}]. label: 1=foreground, 0=background. |
box | array | optional | Prompt mode. [x1, y1, x2, y2]. |
curl -X POST https://api.cn8.io/v1/proxy/studio-segment \
-H "X-API-Key: <cn8_api_key>" \
-H "Content-Type: application/json" \
-d '{"imageUrl":"https://example.com/file"}'{
"status": "success",
"data": {
"image_size": { "width": 1920, "height": 1080 },
"segments": [
{
"id": 0,
"bbox": [120, 60, 380, 290],
"area": 45230,
"predicted_iou": 0.96,
"stability_score": 0.93,
"mask_rle": { "size": [1080, 1920], "counts": [0, 500, 200] },
"centroid": [310, 205]
}
],
"segment_count": 12
},
"usage": { "units": 1, "unit_type": "item" }
}
Auto Mode
In auto mode, the model scans the entire image (or region if provided) and returns up to 100 segments sorted by area. Each segment includes a COCO RLE mask that can be passed directly to the Inpainting service.
curl -X POST https://api.cn8.io/v1/proxy/studio-segment \
-H "X-API-Key: apk_your_key" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://s3.../photo.jpg",
"mode": "auto"
}'
Prompt Mode
In prompt mode, provide point coordinates or a bounding box to target a specific object. Returns up to 3 mask candidates ranked by confidence.
curl -X POST https://api.cn8.io/v1/proxy/studio-segment \
-H "X-API-Key: apk_your_key" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://s3.../photo.jpg",
"mode": "prompt",
"points": [{"x": 450, "y": 300, "label": 1}]
}'