SnapEditDocs
API HomeGet API Key
API Reference

Detect objects in image

object-detection

Automatically detect removable objects in an image. Use the returned session_id and selected detected_objects item with the Remove Objects API.

post/v1/images/detect-objects

Credit cost: 1

Authorization β€” This endpoint requires an API key. Pass it in the api-key header on every request. See the quickstart

Body

NameTypeStatusDescription
input_image
fileRequiredImage file or URL to detect objects in.
lang
stringOptionalLanguage for object class names.(default: en)

Responses

Objects detected successfullyDetectionResponse

NameTypeDescription
session_idstringSession ID for the processed image. Pass as `original_session_id` to the Remove Objects API.
detected_objectsobject[]Detected regions sorted by confidence (descending)
boxnumber[]Bounding box [x1, y1, x2, y2]
maskstringBase64-encoded RGBG mask (same resolution as bbox)
accuracynumberConfidence score (0.0 to 1.0)
object_typestringDetection category
object_descriptionstringDetection class name
curl -X POST "https://api.snapapi.ai/v1/images/detect-objects" \
  -H "api-key: YOUR_API_KEY" \
  -F "input_image=@./image.jpg" \
  -F "lang=en"
Response
{
  "session_id": "sess_abc123",
  "detected_objects": [
    {
      "box": [
        120,
        50,
        300,
        400
      ],
      "mask": "base64_encoded_data...",
      "accuracy": 0.95,
      "object_type": "person",
      "object_description": "person"
    }
  ]
}

Examples

(1 example)

Input

Input 1

Output

Output