v1

latestOpenAPI 3.0.02026-07-13650400.5 KB
Image Editing

Get Masks

Description

Note: This API route requires the image to be registered via the /register route.

The Objects/Mask Generator Route is used to generate all possible masks for an image, creating a full segmentation of the image.

The response contains a zip file named as the visual_id of the provided image.

There are k mask files in the zip, each named with the visual_id and mask_id.

The zip file contains an additional file whose name ends with "panoptic". It's not an image, it's a panoptic map. It can be transformed into a regular matrix.

Each point in the image (x,y) is mapped to the mask that applies to that point. In the panoptic map, each pixel's grayscale value includes the mask_id.

You can display those masks to the user, let them pick one or more masks, and use objects/remove route to remove the masked area.

In order to use the objects/remove route on the mask the user selected, you should provide the mask_id, and use the parameter mask_source=generated.

You can see below an example of the content of the zip:

  92bf8ce17584de82_panoptic.png

  
  92bf8ce17584de82_1.png

  
  92bf8ce17584de82_2.png

  
  92bf8ce17584de82_3.png

  
  ...

  
  92bf8ce17584de82_86.png

You can access the SDK that demonstrates how to use this endpoint in a UI in the following <a href="https://github.com/Bria-AI/js-api-sdk/blob/50a062867092788aaa9612f2cc69f7692567115a/mask_hover_ui" target="_blank">link</a>.

post/objects/mask_generator

Headers

api_tokenstring required

Request body

image_urlstring

The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.

filestring

The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.

Response

Successful operation.

objects_masksstring

Example response

{
  "objects_masks": "https://bria-image-repository.s3.amazonaws.com/mask2click/masks/92bf8ce17584de82.zip?AWSAccessKeyId=AKIAUL5JH7ABJXXBAV6D&Signature=vCX%2BHEAnGmUolwLxKfPBBKPUZaM%3D&Expires=1690732111"
}