Image to Mask
Image to Mask
POST https://api.novita.ai/v3/img2mask
Transform an image into its corresponding mask.
Example
This API converts an image into its corresponding mask.
Please set the Content-Type
header to application/json
in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.
Request:
curl --location 'https://api.novita.ai/v3/img2mask' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data '{
"image_file": "{{Base64 encoded image}}"
}'
Original Image
:
HTTP status codes in the 2xx range indicate that the request has been successfully accepted. A code of 400 means there is an error with the request parameters, while status codes in the 5xx range indicate internal server errors.
You can find the mask image_file
in the masks
field of the response.
Mask Images
:
Response:
{
"masks": [
{
"image_file": "{{Base64 encoded mask}}",
"image_type": "png",
"bbox": [
0,
0,
1023,
958
],
"area": 304278
},
{
"image_file": "{{Base64 encoded mask}}",
"image_type": "png",
"bbox": [
274,
114,
448,
909
],
"area": 281126
},
{
"image_file": "{{Base64 encoded mask}}",
"image_type": "png",
"bbox": [
5,
36,
354,
987
],
"area": 138738
},
{
"image_file": "{{Base64 encoded mask}}",
"image_type": "png",
"bbox": [
284,
491,
435,
391
],
"area": 79647
},
{
"image_file": "{{Base64 encoded mask}}",
"image_type": "png",
"bbox": [
332,
512,
284,
511
],
"area": 77496
},
{
"image_file": "{{Base64 encoded mask}}",
"image_type": "png",
"bbox": [
688,
683,
319,
340
],
"area": 71202
}
]
}