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.
Requires an authenticated user with objects.read permission.
Parameters
Parameter | Type / required | Default and behavior |
|---|---|---|
integer / optional | Omitted: do not retain a reference for later commands in this query. | |
Boolean / optional |
| |
expression / optional | Omitted: no property filter; other restrictions still apply. | |
object / optional | Omitted: no graph-neighbor restriction. | |
object / optional | Omitted: no connection-endpoint restriction. | |
Boolean / optional |
| |
Boolean / optional |
| |
object / optional | Omitted: no requested property projection or aggregate. Select output or retain a reference as described below. | |
object / optional | Omitted: no distributed result batching. | |
string, object, or array / optional | Omitted: no explicit property ordering; nearest-neighbor commands have their own distance ordering. | |
integer 0–2147483647 / optional | Omitted: no explicit result-count limit. | |
integer 0–2147483647 / optional |
| |
Boolean / optional |
|
Parameter | Type / required | Default and behavior |
|---|---|---|
string / optional | Omitted: no label filter. Compare the stored _label for exact equality. | |
integer 1–100000 / optional | Omitted: no parent-image restriction. Must refer to images declared earlier in this query; intersect their bounding boxes with other filters, including is_connected_to. | |
object / optional | Omitted: no spatial restriction. Require the box to lie fully inside x, y, width, height. All four fields are integers; x/y are 0–2147483647 and width/height are 1–2147483647. | |
boolean / optional | false; true returns an encoded crop from each bounding box’s associated image. Requires retrievable parent image data; no input blob is consumed. | |
| string: jpg, png, tif / optional | Omitted: preserve the parent image encoding. Re-encode returned crops only when blobs:true; stored images are unchanged. |
| boolean / optional | false; true returns the rectangle as _coordinates with x, y, width, height. |
| boolean / optional | false unless results.all_properties:true; true returns stored _area in square pixels. Explicit false disables this extra property selection. |
| boolean / optional | false unless results.all_properties:true; true returns _label. Explicit false disables this extra property selection. |
Details
image_ref and is_connected_to can be combined; both restrictions apply. Omit either to remove that restriction. Property and rectangle filters are intersected with the selected image relationships.
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 “blobs” parameter to “true”, in which case, the encoded pixel data of the bounding box will be returned as a blob.
If only one ref parameter is used in the is_connected_to array, the resulting objects obtained after traversing the given connection can be associated with their source objects by specifying the parameter group_by_source as true. Similarly, if the image_ref parameter is used, the results can be grouped by the source image. The parameter is ignored if neither is_connected_to nor image_ref is used. It is set to false by default.
Response and recovery
A successful command returns status: 0 and returned. Requested metadata appears in entities; a reference-only lookup can match objects without returning metadata. returned counts delivered objects or blobs, not every graph match. Use results.count to request a match count.
When blobs are returned, blobs_start identifies the first output blob. Where metadata accompanies blob data, _blob_index associates it with the query’s output blob array. See API Description for blob ordering.
Choose at least one of _ref, results, uniqueids: true, blobs: true, coordinates: true, areas: true, or labels: true. Missing parent images or failed crop/encoding operations can return status: -1. Metadata-only searches do not need to retrieve the parent image.
Invalid parameters, undeclared or incorrectly typed references, and failed output validation return status: -1 with info. A violated unique: true expectation returns status: 3. A response that exceeds the configured message budget can return status: 4; reduce the result limit or requested data. See Responses for error envelopes and retry guidance.
Examples
Find the bounding boxes connected to the image with “unique_id” = 34, and of the label = “Dog”:
[{
"FindImage": {
"_ref": 1,
"constraints": ["$unique_id", "==", 34],
"blobs": true
}
}, {
"FindBoundingBox": {
"image_ref": 1,
"blobs": false,
"coordinates": true,
"labels": true,
"with_label": "Dog",
"results": {
"list": ["label_id"]
}
}
}]
Successful response:
[{
"FindImage": {
"blobs_start": 0,
"returned": 1,
"status": 0
}
}, {
"FindBoundingBox": {
"entities": [{
"_coordinates": {
"height": 40,
"width": 40,
"x": 120,
"y": 50
},
"_label": "Dog",
"label_id": 32
}],
"returned": 1,
"status": 0
}
}]
Find the bounding boxes connected to the image with “unique_id” = 34, and that are inside a given rectangle:
[{
"FindImage": {
"_ref": 1,
"constraints": ["$unique_id", "==", 34],
"blobs": true
}
}, {
"FindBoundingBox": {
"image_ref": 1,
"blobs": false,
"coordinates": true,
"labels": true,
"in_rectangle": {
"x": 100,
"y": 0,
"width": 500,
"height": 500
},
"results": {
"list": ["id"]
}
}
}]
Successful response:
[{
"FindImage": {
"blobs_start": 0,
"returned": 1,
"status": 0
}
}, {
"FindBoundingBox": {
"entities": [{
"_coordinates": {
"height": 40,
"width": 40,
"x": 120,
"y": 50
},
"_label": "Dog",
"id": null
}],
"returned": 1,
"status": 0
}
}]
Find all bounding boxes with the “label” = “dog” and “year” = 2005, and retrieve each bounding box pixel data, encoded as “jpg”:
[{
"FindBoundingBox": {
"with_label": "Dog",
"constraints": ["$year", "==", 2005],
"blobs": true,
"as_format": "jpg"
}
}]
Successful response:
[{
"FindBoundingBox": {
"blobs_start": 0,
"returned": 1,
"status": 0
}
}]