FindBoundingBox

Find bounding boxes that satisfy the specified constraints.

Bounding boxes pixel data is optionally returned as blobs (encoded images) in the array of blobs.

Parameters

  • [optional] _ref: Reference to be used within the transaction.
  • [optional] unique: Indicates whether a single object is expected to satisfy the constraints.
  • [optional] format: Specify the format of the returned bounding box [“jpg”, “png”, “tdb”]. By default, the images will keep they original format.
  • [optional] image: Reference to an image within the transaction (either the result of a FindImage or an AddImage) from which the corresponding bounding boxes will be retrieved.

Blocks

Details

Either image OR link can be present, not both. It is also possible to specify niether image nor link, in which case the search will be contraint by the constraints block.

By default, this command does not return the pixel data corresponding to the bounding box. One can specify that the pixel data be returned but setting the “blob” flag to “true” in the results block, in which case, the encoded pixel data of the bounding box will be returned as a blob.

If rectangle is specified, the bounding boxes returned must be fully within the dimensions indicated by the given rectangle.

Including the _coordinates keyword in the “list” array of the results block will return a list of the coordinates matching the specified criteria.

Examples

Find the bounding boxes connected to the image with “unique_id” = 34:

[ {
    "FindImage" : {
        "_ref" : 1,
        "constraints" : {
            "unique_id" : [ "==", 34]
        }
    }
},{
    "FindBoundingBox": {
        "image" : 1,
        "results": {
            "list": ["_coordinates"]
        }
    }
} ]

Find all bounding boxes with the “label” = “dog”, and retrieve each bounding box pixel data, encoded as “jpg”:

[ {
    "FindBoundingBox": {
        "constraints" : {
            "label" : ["==", "dog"]
        },
        "format": "jpg",
        "results": {
            "blob": true
        }
    }
} ]