About this endpoint
What it does
Segments an object in an uploaded image using a specified pixel coordinate as the prompt. It accepts the image file plus point coordinates, and returns one or more predicted masks along with the selected point and the index of the best mask.
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| x | Integer | No | X pixel coordinate. |
| y | Integer | No | Y pixel coordinate. |
| file | String | Yes | Image file to segment. Binary upload. |
| label | ENUM | No | Prompt label: 0 = background (exclude), 1 = foreground (include). Default: 1. |
Response
Returns a JSON object with masks as an array of mask objects, point as an object containing the prompted x and y coordinates, and best_mask_index as an integer. Each mask includes an index integer, a score number, and a mask_rle object describing the run-length encoded mask.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| masks | Object Array | No | Array of predicted masks. Each item contains index (integer), score (number), and mask_rle (object). |
| point | Object | No | The prompt point used for segmentation. Contains x and y integer coordinates. |
| best_mask_index | Integer | No | Index of the mask selected as the best prediction. |